$(document).ready(function(){ $("ul.subnav").parent().append(""); //only shows drop down trigger when js is enabled (adds empty span tag after ul.subnav*) $("ul.topnav li a").mouseover(function() { //when trigger is clicked... //following events are applied to the subnav itself (moving subnav up and down) $(this).parent().find("ul.subnav").slidedown('fast').show(); //drop down the subnav on click $(this).parent().hover(function() { }, function(){ $(this).parent().find("ul.subnav").slideup('slow'); //when the mouse hovers out of the subnav, move it back up }); //following events are applied to the trigger (hover events for the trigger) }).hover(function() { $(this).addclass("subhover"); //on hover over, add class "subhover" }, function(){ //on hover out $(this).removeclass("subhover"); //on hover out, remove class "subhover" }); });