Advanced Search

Results 1 to 6 of 6

Thread: Creating a selection class for second and third level items that opens a new sub menu

  1. #1
    Join Date
    Jul 2011
    Posts
    29
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Unhappy Creating a selection class for second and third level items that opens a new sub menu

    Hi.

    I am using ddlevelsmenu for creating multi level navigation. Below is the link.

    http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/

    From the example that you find on the above link, when I mouseover on for instance "CSS Library", which opens a submenu, when I move to its menu items like "Item 1a", "Item 2a", etc., the mouseover color for "CSS Library" stays at black and does not get removed until I move to the next items.

    But when I go to "Item folder 3a" under the same sub menu, when I move to its sub items, the selection color gets removed.

    What I want is when I move to any item that has the submenu, on mouse over, the background color should stay for the list item that opens the sub menu.

    Awaiting solutions.

    Thanks.

    - Harleyy

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,699
    Thanks
    43
    Thanked 3,132 Times in 3,096 Posts
    Blog Entries
    12

    Default

    Try:

    http://www.dynamicdrive.com/dynamici...smoothmenu.htm

    In it the top level menus and the sublevel menus are styled the same, but they don't have to be (see its stylesheet for styling those separately). Any item that's showing a dropdown has a class of "selected".
    Last edited by jscheuer1; 10-07-2013 at 01:24 PM. Reason: add info
    - John
    ________________________

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

  3. #3
    Join Date
    Jul 2011
    Posts
    29
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot sir for your reply.
    But I have been using this menu and have created it on a lot of pages, so replacing it would be very difficult for me. Is there a way where we can make the same functionality for the ddlevelsmenu??

    Awaiting replies.

    Regards,
    - Harleyy.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,699
    Thanks
    43
    Thanked 3,132 Times in 3,096 Posts
    Blog Entries
    12

    Default

    OK, use this modified version of the script (right click and 'Save As'):

    ddlevelsmenu.js

    Once installed, this selector will govern the class of the selected items:

    Code:
    .ddsubmenustyle li.selected > a
    So for instance, using demo.htm from the distribution archive, in its ddlevelsmenu-topbar.css file, at the end, I added the highlighted:

    Code:
    .mattblackmenu a.selected, .ddsubmenustyle li.selected > a {
    background: black; /*background of tab with "selected" class assigned to its LI */
    color: white;
    }
    Demo:

    http://home.comcast.net/~jscheuer1/s...evels/demo.htm

    The browser cache may need to be cleared and/or the page refreshed to see changes.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

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

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Harleyy (10-08-2013)

  6. #5
    Join Date
    Jul 2011
    Posts
    29
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot sir. It worked perfectly well.

  7. #6
    Join Date
    Jul 2011
    Posts
    29
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Thank you sir for your solution. Is there a way to keep the selection selected when we click and select any of the list items?

    For Instance, from your demo, http://home.comcast.net/~jscheuer1/s...evels/demo.htm
    if I go to "CSS", under that select "Item folder 3b" and click on "sub item 3.2b", is there a way when I get redirected to the page linked with "sub item 3.2b" and on load of that page, the selection for "CSS", "Item folder 3b" and "sub item 3.2b" with their hover background characteristics remain as selected?

    Awaiting replies,

    Regards,
    - Harleyy
    Last edited by Harleyy; 10-09-2013 at 09:10 AM. Reason: further addition

Similar Threads

  1. ddSmoothMenu problem styling unlinked top level menu items
    By dgibb in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 01-02-2013, 07:01 PM
  2. ddlevelsmenu items selection problem
    By Peggy_Z in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 11-24-2011, 05:50 AM
  3. Accordion Menu: Need sub-level to have selected class
    By cjglynn in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 07-20-2009, 09:26 PM
  4. Multi level menu, that opens/closes on click
    By arbel in forum JavaScript
    Replies: 6
    Last Post: 09-20-2007, 11:31 AM
  5. Setting Target for Top Level Menu Items in Switch Menu
    By So_Cute in forum Dynamic Drive scripts help
    Replies: 7
    Last Post: 08-15-2005, 03:37 AM

Tags for this Thread

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
  •