Advertisement
Guest User

not working

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