PDA

View Full Version : ddsmoothmenu onclick collapse and expand



textile
10-05-2010, 06:40 PM
1) Script Title: ddsmoothmenu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm#

3) Describe problem:
I've done a search and didn't find exactly what I'm looking for. I'm using the ddsmoothmenu (vertical orientation) on a site and the client now wants to have the top level menu items collapse and expand on click rather than on hover. There are only a few instances where there is a dropdown...and those instances only have one sublevel.

I've spent a TON of time styling the menu(s) with CSS and so I really don't want to have to start all over with another script just to add the (hopefully) simple functionality.

Please let me know if more info is needed for a proper answer.

Thanks!
Casey

divabanana
04-12-2011, 10:18 PM
I know this is old but here's a partial answer for anyone wanting the same thing. I only wanted the 'close on click' functionality.

I'm using jQuery on my page and here's the relevant part of the code...


<script type="text/javascript">
$(document).ready(function() {
$('.ddsmoothmenu a').click(function(){
//...
$("#smoothmenu1").find("ul").find("li").mouseleave();
//...
});
</script>

This catches any <a> tag within the div id of 'smoothemenu1' and will give you the close menu animation as if your mouse moved off the menu.

Hope that makes sense!