Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-09-2013, 07:34 PM   PM User | #1
cgdtalent
New Coder

 
Join Date: Jan 2013
Posts: 35
Thanks: 11
Thanked 1 Time in 1 Post
cgdtalent is an unknown quantity at this point
jQuery Tabs Question

I have a simple jQuery tabs application that works fine but I wanted to basically duplicate the navigation at the bottom each tab/page so I could have a "Next" and "Back" button. I figured since their ID's would be pointing to the same place, they'd create active instances for both buttons. So if it's on tab one, it'll show a "Next" button pointing to #two. When I click on "Next", it does go to tab 2 but it doesn't update the active state for the top button. I don't understand how jQuery differentiates which one is clicked because their target ID's are the same, and UL class is the same...

But here is the basic HTML code:

Code:
<div id="top_navigation">
      <ul class="idTabs">
        <li class="info_one"><a href="#one" >Appraiser Information</a></li>
        <li class="info_two"><a href="#two">Contract</a></li>
       </ul>
</div>
<div id="one">
Tab one content goes here
<div id="bottom_navigation">
      <ul class="idTabs">
      <li class="contract"><a href="#two">Next</a></li>
      </ul>
</div>
</div>

<div id="two">
Tab two content goes here
<div id="bottom_navigation">
      <ul class="idTabs">
      <li class="contract"><a href="#one">Back</a></li>
      </ul>
</div>
</div>
And here is where I think the active states are updated in the jQuery code:

Code:
if(s.click && !s.click.apply(this,[id,idList,tabs,s])) return s.change; 

      //Clear tabs, and hide all 
      for(i in aList) $(aList[i]).removeClass(s.selected); 
      for(i in idList) $(idList[i]).hide(); 

      //Select clicked tab and show content 
      $(this).addClass(s.selected); 
      $(id).show(); 
      return s.change; //Option for changing url 
      } 
 
    //Bind idTabs 
    var list = $("a[href*='#']",tabs).unbind(s.event,showId).bind(s.event,showId); 
    list.each(function(){ $("#"+this.href.split('#')[1]).hide(); });
Is there a way to modify this so the active states update on both buttons?
cgdtalent is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:44 PM.


Advertisement
Log in to turn off these ads.