Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. Licenciaturas
  2. <ul class="navi">
  3. <li><a class="menu2" href="#tab1">Eng Inf</a></li>
  4. <li><a class="menu3" href="#tab2">Eng Quimic</a></li>
  5. <li><a class="menu4" href="#tab3">Eng Civil</a></li>
  6. </ul>
  7. <br><br>
  8. Mestrados
  9. <ul class="navi">
  10. <li><a class="menu2" href="#tab10">Mestrado 1</a></li>
  11. <li><a class="menu3" href="#tab11">Mestrado 2</a></li>
  12. <li><a class="menu4" href="#tab12">Mestrado 3</a></li>
  13. <li><a class="menu5" href="#tab13">Mestrado 4</a></li>
  14. <li><a class="menu6" href="#tab14">Mestrado 5</a></li>
  15. </ul>
  16.  
  17.  
  18. <div id='tab1'>
  19. TEXTO LICENCIATURA 1
  20. </div>
  21. <div id='tab2'>
  22. TEXTO LICENCIATURA 2
  23. </div>
  24. <div id='tab10'>
  25. TEXTO Mestrado 1
  26. </div>
  27. <div id='tab11'>
  28. TEXTO Mestrado 2
  29. </div>
  30.  
  31.  
  32.  
  33.  
  34. $('ul.navi').each(function () {
  35. // For each set of tabs, we want to keep track of
  36. // which tab is active and it's associated content
  37. var $active, $content, $links = $(this).find('a');
  38.  
  39. // If the location.hash matches one of the links, use that as the active tab.
  40. // If no match is found, use the first link as the initial active tab.
  41. $active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]);
  42. $active.addClass('active');
  43.  
  44. $content = $($active[0].hash);
  45.  
  46. // Hide the remaining content
  47. $links.not($active).each(function () {
  48. $(this.hash).hide();
  49. });
  50.  
  51. // Bind the click event handler
  52. $(this).on('click', 'a', function(e){
  53. // Make the old tab inactive.
  54. $active.removeClass('active');
  55. $content.hide();
  56.  
  57. // Update the variables with the new link and content
  58. $active = $(this);
  59. $content = $(this.hash);
  60.  
  61. // Make the tab active.
  62. $active.addClass('active');
  63. $content.show();
  64.  
  65. // Prevent the anchor's default click action
  66. e.preventDefault();
  67. });
  68.  
  69.  
  70.  
  71. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement