Results 1 to 6 of 6

Thread: Closing all menus on click - smooth menu issue

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

    Default Closing all menus on click - smooth menu issue

    1) Script Title: Smooth Navigational Menu

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...smoothmenu.htm

    3) Describe problem: There is an option to close all the menus when the mouse clicks on the area outside of the menu or when the mouse loses focus from the menu but what I need is to close all menus that are open when a menu item is selected. Right now if you set

    closeonnonmenuclick: true, //when clicking outside of any "toggle" method menu, should all "toggle" menus close?
    closeonmouseout: false, //when leaving a "toggle" menu, should all "toggle" menus close? Will not work on touchscreen

    the nested list of menus will remain open until you click on an area outside of the menu. I want all menus to close (invoke the closeall function) when a menu item has been selected. This seems like a logical way to handle menu selections and the "All levels navigational menu" (http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/) works this way but I want the smooth menu to work that same way. What modification do you suggest to make that happen (I *think* I want to trigger the closeAll function when an anchor link is clicked)

    Thanks

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

    Default

    It is a pretty hacky solution but I added the following to the executelink function at line 81 (just before the e.stopPropagation(); call) to get what I needed:

    e.type = 'mouseleave';
    ddsmoothmenu.closeall(e);

    Now when I click on the link, all the other nested menus close.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    Are you sure you're using the latest version? Are you having this problem on the demo page?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Default

    I just pulled the code and the demo page doesn't demonstrate the problem because it navigates to a different website. In my case, the menu selection inserts and begins to play a video using ajax without navigating away from the page. The open levels of the menu stay open with only the selected item closing. If if you are four levels deep in the menu, after you click on an item on the fourth level, the fourth level closes but the rest stay open.

    Here is a demo that demonstrates the issue: http://www.petesworkshop.com/test/smooth-test-2.html . Follow the "Training Videos - STL" menu all the way to the end and select something on the menu. You will see that only the last menu closes, the other levels stay open. (a video isn't inserted in this demo, just the title)

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    OK, I missed that this was a special case. Setting the event type on an object (e is an object in that code right?*) like that and passing that object to the desired function is perfectly fine. Just make sure you're doing it at the most opportune point or points in your code.

    *One can create the object and pass it all on one line:

    Code:
    ddsmoothmenu.closeall({type: 'mouseleave'});
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Dec 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks John..the shorter code is actually a bit more clear so I'll take that approach.

Similar Threads

  1. Replies: 0
    Last Post: 05-06-2012, 03:49 AM
  2. Closing Div Layer on body click
    By spiderphp in forum JavaScript
    Replies: 1
    Last Post: 11-16-2011, 03:30 PM
  3. Cells and Text Shrink on Click in Smooth Navigational Menu (v1.4)
    By frocksie in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 07-12-2010, 11:07 PM
  4. Smooth Menus and IE 8 Issue
    By gowindholz in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 01-03-2010, 05:36 AM
  5. Smooth Menu Click/Shadow probs.
    By Cody J in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 01-27-2009, 12:03 AM

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
  •