Results 1 to 5 of 5

Thread: Ajax Tabs Content Script - Can it return to the top when using embedded links?

  1. #1
    Join Date
    Oct 2004
    Location
    MN, USA
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Ajax Tabs Content Script - Can it return to the top when using embedded links?

    1) Script Title: Ajax Tabs Content script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tent/index.htm

    3) Describe problem: In this script you can put an embedded link in the body of the message which opens any of the external html pages. However, if your page is quite long and you use these at the bottom to give a bottom navbar effect, the page is displayed but you are at the bottom of the page and have to scroll back up to the top. An example might be http://www.read-how.com/business/education.html I am playing around with this now, so it might be changing as you look at it.

    Thanks,
    dave

  2. #2
    Join Date
    Oct 2004
    Location
    MN, USA
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    One more note.....depending on your screen resolution it may appear that it is bouncing back to the top. Try setting your browser to a screen resolution of 800x600 or 1024x768 and I think that will represent better what I am seeing.

    Thanks,
    dave

  3. #3
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    There are many ways to get the browser to jump back up to the tab content when a link is clicked on. For example, try this:

    Code:
    <script type="text/javascript">
    
    function focusit(tabid){
    if (document.body.scrollIntoView)
    document.getElementById(tabid).scrollIntoView()
    }
    
    </script>
    
    <a href="javascript: expandtab('maintab', 2); focusit('maintab')">Select 3rd tab of "maintab"</a>
    Notice the code in red.

  4. #4
    Join Date
    Oct 2004
    Location
    MN, USA
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question That did't work?

    I have applied it to the external pages called by the ajax script on this page: http://www.read-how.com/business/bus...education.html

    However, when I use the links at the bottom to open a new external page it still isn't going back to the top of the page. Did I do it wrong?

    One of the external pages where I added the focusit is here: http://www.read-how.com/business/bus...ducation1.html

    Thanks,
    dave

  5. #5
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Make sure the script itself is added to your main page, not one of the education_INTEGER.html pages. In other words, the script:

    Code:
    <script type="text/javascript">
    
    function focusit(tabid){
    if (document.body.scrollIntoView)
    document.getElementById(tabid).scrollIntoView()
    }
    
    </script>
    should be added to http://www.read-how.com/business/bus...education.html If you add it to one of the external pages being fetched instead, due to limitations in Ajax, that function won't get successfully added to the main page.

    BTW, please note that your page is currently in violation of our usage terms, since the credit notice doesn't appear inline on the page. Please reinstate the credit notice.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •