/ Published in: jQuery

Simple solution to add dropdowns quickly to any site.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function dropdown_menu() { $("#sub-menu-id a, .subnav a"); $(" #sub-menu-id ").css({ display: "none", opacity: "1" }); // fix for opera browser $("#sub-menu-id li").each(function () { var $subNav = jQuery(this).find('ul:first'); $(this).hover(function () { $subNav.stop().css({ overflow: "hidden", height: "auto", display: "none" }).slideDown(350, function () { $(this).css({ overflow: "visible", height: "auto" }); }); }, function () { $subNav.stop().slideUp(350, function () { $(this).css({ overflow: "hidden", display: "none" }); }); }); }); } //USAGE <script> jQuery(document).ready(function () { dropdown_menu(); }); </script>
URL: http://www.design-ninja.net
Comments
