/ Published in: JavaScript
Simply jQuery script for CSS drop-down menu
Expand |
Embed | Plain Text
$(document).ready(function() { //Main nav drop-downs $('#header ul li').each(function() { $(this).mouseover(function() { $(this).children('ul').css("display", "block"); }); $(this).mouseout(function() { $(this).children('ul').css("display", "none"); }); }); });
Comments
Subscribe to comments
You need to login to post a comment.

It would be even better if you use slideDown and slideUp instead of .css:
$(document).ready(function() { //Main nav drop-downs $('#header ul li').each(function() { $(this).mouseover(function() { $(this).children('ul').stop().slideDown(); }); $(this).mouseout(function() { $(this).children('ul').stop().slideUp(); }); }); });
The stop() is to prevent troubles when hovering in and out too fast