Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Licenciaturas
- <ul class="navi">
- <li><a class="menu2" href="#tab1">Eng Inf</a></li>
- <li><a class="menu3" href="#tab2">Eng Quimic</a></li>
- <li><a class="menu4" href="#tab3">Eng Civil</a></li>
- </ul>
- <br><br>
- Mestrados
- <ul class="navi">
- <li><a class="menu2" href="#tab10">Mestrado 1</a></li>
- <li><a class="menu3" href="#tab11">Mestrado 2</a></li>
- <li><a class="menu4" href="#tab12">Mestrado 3</a></li>
- <li><a class="menu5" href="#tab13">Mestrado 4</a></li>
- <li><a class="menu6" href="#tab14">Mestrado 5</a></li>
- </ul>
- <div id='tab1'>
- TEXTO LICENCIATURA 1
- </div>
- <div id='tab2'>
- TEXTO LICENCIATURA 2
- </div>
- <div id='tab10'>
- TEXTO Mestrado 1
- </div>
- <div id='tab11'>
- TEXTO Mestrado 2
- </div>
- $('ul.navi').each(function () {
- // For each set of tabs, we want to keep track of
- // which tab is active and it's associated content
- var $active, $content, $links = $(this).find('a');
- // If the location.hash matches one of the links, use that as the active tab.
- // If no match is found, use the first link as the initial active tab.
- $active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]);
- $active.addClass('active');
- $content = $($active[0].hash);
- // Hide the remaining content
- $links.not($active).each(function () {
- $(this.hash).hide();
- });
- // Bind the click event handler
- $(this).on('click', 'a', function(e){
- // Make the old tab inactive.
- $active.removeClass('active');
- $content.hide();
- // Update the variables with the new link and content
- $active = $(this);
- $content = $(this.hash);
- // Make the tab active.
- $active.addClass('active');
- $content.show();
- // Prevent the anchor's default click action
- e.preventDefault();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement