Results 1 to 6 of 6

Thread: Anchor Links from outside of a Tab? Tab Script v2.2

  1. #1
    Join Date
    Dec 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Anchor Links from outside of a Tab? Tab Script v2.2

    1) Script Title: Tab Content Script (v 2.2)

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

    3) Describe problem:

    http://www.datacore.com/partners/partners_worldwide.asp

    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?

    Thanks!

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

    Default

    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:

    Code:
    <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">
    <ul>
    <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>
    </ul>
    <br style="clear: left" />
    </div>
    
    <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>
    
    <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>
    
    <div id="dog3" class="tabcontent">
    Tab content 3 here<br />Tab content 3 here<br />
    </div>
    
    <div id="dog4" class="tabcontent">
    Tab content 4 here<br />Tab content 4 here<br />
    </div>
    
    </div>
    
    
    <script type="text/javascript">
    
    var mypets=new ddtabcontent("pettabs")
    mypets.setpersist(true)
    mypets.setselectedClassTarget("link")
    mypets.init(2000)
    
    </script>
    DD Admin

  3. #3
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi there, i was wondering if i could do the same thing if using the ajaxcar demo

    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?

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

    Default

    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:

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

  5. #5
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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:

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

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

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

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

    Default

    I'm confused. I thought you were asking about the script Ajax Content script?
    DD Admin

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
  •