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

JOHNFROG
JOHNFROG used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
change line 12 & 13 to:
<script type=text/javascript>$(document).ready(function () {$('services-container').scrollTo('service3');});</script>

Open in new window

Commented:
***
cstext1.Append("<script type=text/javascript>$(document).ready(function () {$('services-container').scrollTo('service3');});</script>")

Open in new window

Commented:
you have an extra semicolon in line 12 after $(document).ready(function (); ... remove it and see what'll happen.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial