View Full Version : Anchor Links from outside of a Tab? Tab Script v2.2

12-03-2008, 05:28 PM
1) Script Title: Tab Content Script (v 2.2)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm

3) Describe problem:


My site uses the Tab script to break down partners in certain regions. You can see that I've used the picture of the earth and the names of these regions to link to the tabcontent.

Since I have very large areas of Tabcontent, I want to be able to link to a specific spot within a tab from anywhere in my page. So For Example, If you were to click on "Germany" you would open up the Europe Tabcontent, and then the anchor would take you down to the content starting with Germany.

Has anyone found a solution to this?


12-03-2008, 11:22 PM
First, try adding a HTML anchor (< name="whatever"></a>) to the position within the Tab Content you wish a link to jump to when clicked on. Then, modify your link's href attribute to go to that HTML anchor while calling tabcontent.expandit() to first expand that Tab Content first. Altogether it may look something like:

<h3>Demo #3- Different Tab Style, "slideshow mode" enabled</h3>

<p><a href="#germany" onClick="mypets.expandit(1)">2nd tab, germany content</a></p>

<div id="pettabs" class="indentmenu">
<li><a href="#" rel="dog1" class="selected">Tab 1</a></li>
<li><a href="#" rel="dog2">Tab 2</a></li>
<li><a href="#" rel="dog3">Tab 3</a></li>
<li><a href="#" rel="dog4" id="myfavorite">Tab 4</a></li>
<li><a href="http://www.google.com">Google</a></li>
<br style="clear: left" />

<div style="border:1px solid gray; width:550px; padding: 5px; margin-bottom:1em">

<div id="dog1" class="tabcontent">
Tab content 1 here<br />Tab content 1 here<br />
<p><b><a href="javascript: mypets.expandit('myfavorite')">Click here to select tab with id="myfavorite"</a></b></p>

<div id="dog2" class="tabcontent">
Tab content 2 here<br />Tab content 2 here<br />
<div style="height:600px"></div>
<a name="germany"></a> Germany description
<div style="height:600px"></div>

<div id="dog3" class="tabcontent">
Tab content 3 here<br />Tab content 3 here<br />

<div id="dog4" class="tabcontent">
Tab content 4 here<br />Tab content 4 here<br />


<script type="text/javascript">

var mypets=new ddtabcontent("pettabs")


02-11-2009, 09:03 AM
hi there, i was wondering if i could do the same thing if using the ajaxcar demo (http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm)

since the list goes all the way down whereby the user needs to scroll down to see the last tab and click then scroll up again to view the content, i was wondering if anyone could help me to make the page goes straight to the top?

02-11-2009, 10:20 PM
Well the concept should be the same Rovska. You'd create a HTML anchor where you want the page to jump to, then inside your link that loads the Ajax page, modify it to something like:

<a href="#myanchor" onClick="ajaxpage('test.htm', 'contentarea');">test</a>

02-12-2009, 03:47 AM
thx for replying, i tried it and it does bring it to the top of the page, but the content doesn't show. i adapted the script to my page it goes like:

<ul id="maintab53" class="shadetabs">
<li><span class="shadetabs"><a href="ilabs.html" rel="ajaxcontentarea">ilabs</a></span></li>

<ul id="maintab53" class="shadetabs">
<li><span class="shadetabs"><a href="#myanchor" onClick="ajaxpage('ilabs.html', 'ajaxcontentarea');">ilabs</a></span></li>

i'm very new to this so sorry if i'm confusing you.

02-12-2009, 07:29 AM
I'm confused. I thought you were asking about the script Ajax Content script (http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm)?