Team:UNITN-Trento/JS/Subs/Header

From 2013.igem.org

$(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") }) }); });