PDA

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



vensland
06-20-2007, 04:22 AM
1) Script Title: Ajax Tabs Content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/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

vensland
06-20-2007, 04:26 AM
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

ddadmin
06-21-2007, 05:49 AM
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:


<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.

vensland
06-21-2007, 01:40 PM
I have applied it to the external pages called by the ajax script on this page: http://www.read-how.com/business/business_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/business_education1.html

Thanks,
:) dave

ddadmin
06-21-2007, 06:22 PM
Make sure the script itself is added to your main page, not one of the education_INTEGER.html pages. In other words, the script:


<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/business_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.