Team:UNITN-Trento/JS/Subs/Header
From 2013.igem.org
(Difference between revisions)
(2 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | |||
$(document).ready(function() { | $(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"). | + | $("#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") }) }); });