Advertisement
Guest User

jquery tabs not working in ie6-7

a guest
May 15th, 2012
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* TABS */
  2. jQuery(document).ready(function($){
  3.  
  4. $('ul.tabs').each(function(){
  5.     // For each set of tabs, we want to keep track of
  6.     // which tab is active and it's associated content
  7.     var $active, $content, $links = $(this).find('a');
  8.  
  9.     // Use the first link as the initial active tab
  10.     $active = $links.first().addClass('active');
  11.     $content = $($active.attr('href'));
  12.  
  13.     // Hide the remaining content
  14.     $links.not(':first').each(function () {
  15.         $($(this).attr('href')).hide();
  16. });
  17.  
  18.       // Bind the click event handler
  19.       $(this).on('click', 'a', function(e){
  20.         // Make the old tab inactive.
  21.         $active.removeClass('active');
  22.         $content.hide();
  23.  
  24.         // Update the variables with the new link and content
  25.         $active = $(this);
  26.         $content = $($(this).attr('href'));
  27.  
  28.         // Make the tab active.
  29.         $active.addClass('active');
  30.         $content.show();
  31.  
  32.         // Prevent the anchor's default click action
  33.         e.preventDefault();
  34.     });
  35. });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement