PDA

View Full Version : Smooth Menu - How to make menu disappear onclick



ibexcentral
12-29-2008, 11:30 AM
1) Script Title: Smooth Menu

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

3) Describe problem:

When I click on a menu item I want to still run the onclick javascript below but I want the menu to disappear as if I moved my mouse off the menu.

<div id="smoothmenu-ajax" class="ddsmoothmenu">
<ul>
<li><a href="javascript:onClick=loadPlaylist('current.php?playlist=VIDEO')">Videos</a>


Can anyone tell me how to do this?

Thanks

ibexcentral
12-29-2008, 01:27 PM
Okay I worked out that you can execute more than one function with onclick event.

What function do I need to call to make the smooth menu hidden/ dissappear (As if I have moved my mouse off the menu)?

The code should look something like this:

<li><a href="javascript:onClick=loadPlaylist('current.php?playlist=VIDEO'); this is where the function goes to make the menu be hidden/ mouse out()">Videos</a>

Please help

Thanks

ddadmin
12-30-2008, 12:38 AM
Please try and format any code in your post using the CODE tags. It just makes it easier to read.

If you want the sub menus to disappear when the mouse clicks on them, find the following line inside the .js file, and add to it the code in red:


$mainmenu.find("ul").css({display:'none', visibility:'visible'}).click(function(e){
$(this).animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime)
this.parentNode.$shadow.stop().css({height:0})
})

Oyabun
12-30-2008, 01:35 AM
Could you please tell me how to open a folder menu by click? :confused:

ibexcentral
12-30-2008, 04:58 AM
Hi,

Absolutely class thanks ever so much for this update to the code works a treat.

Oyabun
12-30-2008, 06:31 PM
Any answers to my question, too?

ibexcentral
12-31-2008, 12:20 AM
Hi,

Thanks again for the code......I need to run a function after the menu is clicked/ hidden.

The function call is:


showdiv()

Please can you tell me where to put this function call in the .js file

Thanks

ddadmin
12-31-2008, 01:07 AM
Oyabun, please start a new thread (http://www.dynamicdrive.com/forums/forumdisplay.php?f=2) when asking your own question.

ibexcentral, you should be able to just add it inside the code above:


$mainmenu.find("ul").css({display:'none', visibility:'visible'}).click(function(e){
$(this).animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime)
this.parentNode.$shadow.stop().css({height:0})
showdiv()
})

Oyabun
12-31-2008, 07:34 AM
Oyabun, please start a new thread (http://www.dynamicdrive.com/forums/forumdisplay.php?f=2) when asking your own question.

ibexcentral, you should be able to just add it inside the code above:


$mainmenu.find("ul").css({display:'none', visibility:'visible'}).click(function(e){
$(this).animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime)
this.parentNode.$shadow.stop().css({height:0})
showdiv()
})


But it's about the same script. Why should i start a new thread then? :rolleyes:
I'd just trash the forums.

ddadmin
12-31-2008, 08:33 AM
Asking your own question in someone else's thread, even if it's on the same script, is distracting to the original poster/ question. One thread should be about one issue.