Link to home
Start Free TrialLog in
Avatar of JOHNFROG
JOHNFROG

asked on

jQuery.ScrollTo - Anyone know how to scroll to a desired item of the scroll plugin on form load?

I have been trying to use RegisterStartupScript to scroll to a specific item but cannot seem to get the script right.

Have supplied the code (not working) I am currently using on form load.

Any help greatly appreciated

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
  Dim csname1 As [String] = "PopupScript"
            Dim cstype As Type = Me.[GetType]()

            ' Get a ClientScriptManager reference from the Page class. 
            Dim cs As ClientScriptManager = Page.ClientScript

            ' Check to see if the startup script is already registered. 
            If Not cs.IsStartupScriptRegistered(cstype, csname1) Then
                Dim cstext1 As New StringBuilder()
                cstext1.Append("<script type=text/javascript>$(document).ready(function (); {$('services-container').scrollTo('service3');});</")
                cstext1.Append("script>")
                cs.RegisterStartupScript(cstype, csname1, cstext1.ToString())
            End If

  End If
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of disrupt
disrupt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
***
cstext1.Append("<script type=text/javascript>$(document).ready(function () {$('services-container').scrollTo('service3');});</script>")

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial