Team:UNITN-Trento/JS/Subs/Header
From 2013.igem.org
(Difference between revisions)
(Created page with " //Javascript here $(document).ready(function() { //Open the submenu $("#tn-menu li").mouseenter(function(e) { e.preventDefault(); $(this).children("ul").slideD...") |
|||
(4 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | + | $(document).ready(function() { | |
- | $( | + | $("#tn-menu > .hasSub > a").each(function() { |
+ | $(this).click(function(e) { | ||
+ | e.preventDefault(); | ||
+ | }); | ||
+ | $(this).mouseenter(function() { | ||
+ | $("#tn-menu > li").removeClass("active"); | ||
+ | $("#tn-menu > li > ul").css({'display' : 'none'}); | ||
- | + | $(this).parent().addClass("active") | |
- | $(" | + | $(this).click(function() { |
- | + | document.location.href = $(this).attr('href'); | |
- | + | ||
}); | }); | ||
- | + | $(this).parent().children("ul").css({'display' : 'block'}); | |
- | + | }) | |
- | + | }); | |
- | + | $("#tn-menu > li:not(.hasSub) > a").each(function() { | |
- | + | $(this).mouseenter(function() { | |
- | }); | + | $("#tn-menu > li").removeClass("active"); |
- | + | $("#tn-menu > li > ul").css({'display' : 'none'}); | |
- | + | $(this).parent().addClass("active") | |
+ | }) | ||
+ | }); | ||
+ | }); |
Latest revision as of 12:11, 9 September 2013
$(document).ready(function() { $("#tn-menu > .hasSub > a").each(function() { $(this).click(function(e) { e.preventDefault(); }); $(this).mouseenter(function() { $("#tn-menu > li").removeClass("active"); $("#tn-menu > li > ul").css({'display' : 'none'});
$(this).parent().addClass("active") $(this).click(function() { document.location.href = $(this).attr('href'); }); $(this).parent().children("ul").css({'display' : 'block'}); }) }); $("#tn-menu > li:not(.hasSub) > a").each(function() { $(this).mouseenter(function() { $("#tn-menu > li").removeClass("active"); $("#tn-menu > li > ul").css({'display' : 'none'}); $(this).parent().addClass("active") }) }); });