Results 1 to 4 of 4

Thread: Current state in Glossy Accordion Menu

  1. #1
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Current state in Glossy Accordion Menu

    1) Script Title: Glossy Accordion Menu

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

    3) Describe problem: First of all, fantastic script. I've customized the CSS to visually match my page, but there is one feature I wish it had, a current state. An example menu:

    Parent A
    - child 1A
    - child 2A
    Parent B
    - child 1B
    - child 2B

    What I am looking for is help adjusting the script so that if you clicked "child 1B" you would be taken to that page and the accordion would remain expanded and the "child 1B" link highlighted letting the viewer know which section they are in. Is this possible?

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

    Default

    There's no easy way to do this using JavaScript actually. Such functionality is usually done on the server side, by dynamically matching the current page's URL with a particular menu item within the menu, then generating the appropriate HTML to "select" it. The tricky part is the matching itself.

    The script does let you have a certain menu item expanded depending on the page the menu is on, but this does mean you have to modify the menu item links with a URL parameter, such as:

    Code:
    <li><a href="target.htm?mypets=1">My pets (2nd header expanded by default)</a></li>
    More info here. But again, this doesn't take care of "highlighting" the selected menu item itself, which can really only be done reliably on the server side.
    DD Admin

  3. #3
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think the first post, like myself, just needs a function to pass an index number to in order to highlight a specific menu item, whether header or sub-header. A typical menu will have some sub-headers but some menu items will be just 1 level with no submenus. The link called can pass the identifier to the next page so then we know what to highlight. Why is this not possible? Don't you think it's a good feature for the menu to indicate which page is currently viewed? I love your script but I need that visual cue.

    Thank you
    Randy

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

    Default

    Maximus:
    The URL parameter feature by default only works on the headers themselves in highlighting a specific header (and not a link within the sub menu content), since the sub menu content technically is just some arbitrary content that the headers expand/ contract, and can contain a whole bunch of things other than menu links. It's certainly possible to modify the feature to also highlight a certain link within the sub menu content, but some "rules" need to be established to let the script know which links are menu links, and which aren't, inside the sub menu content.

    I'll consider adding the above feature the next time the script is updated.
    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
  •