Results 1 to 10 of 10

Thread: Smooth Menu - How to make menu disappear onclick

  1. #1
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Smooth Menu - How to make menu disappear onclick

    1) Script Title: Smooth Menu

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...smoothmenu.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="javascriptnClick=loadPlaylist('current.php?playlist=VIDEO')">Videos</a>


    Can anyone tell me how to do this?

    Thanks
    Last edited by ibexcentral; 12-29-2008 at 01:03 PM.

  2. #2
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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="javascriptnClick=loadPlaylist('current.php?playlist=VIDEO'); this is where the function goes to make the menu be hidden/ mouse out()">Videos</a>

    Please help

    Thanks

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    	$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})
    	})
    DD Admin

  4. #4
    Join Date
    Dec 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Could you please tell me how to open a folder menu by click?
    Last edited by Oyabun; 12-30-2008 at 02:16 AM.

  5. #5
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

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

  6. #6
    Join Date
    Dec 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Any answers to my question, too?

  7. #7
    Join Date
    Dec 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

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

    The function call is:

    Code:
    showdiv()
    Please can you tell me where to put this function call in the .js file

    Thanks

  8. #8
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Oyabun, please start a new thread when asking your own question.

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

    Code:
    	$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()
    	})
    DD Admin

  9. #9
    Join Date
    Dec 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    Oyabun, please start a new thread when asking your own question.

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

    Code:
    	$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?
    I'd just trash the forums.

  10. #10
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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.
    DD Admin

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •