Advanced Search

Results 1 to 7 of 7

Thread: DD Mouse Over Tab Menu: How ot make submenu active?

  1. #1
    Join Date
    Jun 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DD Mouse Over Tab Menu: How ot make submenu active?

    1) Script Title:
    Mouse Over Tab Menu

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

    3) Describe problem:
    I have everything working, but I want to make the SUBMENU button active after clicking on it.
    I have very BASIC javascript experience, I tried a couple of options, but none of them work.
    Here a link, please note only clicking on SERVICES and its submenu will work in this version:
    http://www.flyingfish.de/dd/Services/index.htm

    I got the main menu active, easy, but how do I tell what button to be active in the external submenu file??

    Thank you!!!

    Desperate,

    A.

  2. #2
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    I am not entirely sure how you want the "active" submenu item to look, but one thing you could do is to add the "selected" class to the link. For example on the communications page you would add it to this link

    <a href="../Services/communications.htm" class="selected">Strategic Communications</a>

  3. #3
    Join Date
    Jun 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you azoomer.

    I simply want the submenu button to be black, same effect as when you rollover.

    With this script, the submenu navigation is an external HTML file, so adding a class=selected to this external file wouldn't make sense.
    Or in other words, the communications page you are referring to DOES NOT contain the link you posted, only the external HTML file contains the submenu buttons. (http://www.flyingfish.de/dd/submenucontents.htm).

    One thought I had was to just get rid of the external submenu file and insert the submenu on EACH page.
    I tried that but there is too much script modification needed to make it work. I cannot do that with my basic knowledge, and might as well choose an entirely different solution then.

    Who created this script anyway? Is there any way to get in touch with that person?

    I just can't imagine it's not possible.

    Still desperate,

    A.

  4. #4
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Yes I can see what you mean. Looking at the documentation I realize that my suggestion wouldn't work at all. I don't have any more "good" ideas right now.

  5. #5
    Join Date
    Jun 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you anyway!!

  6. #6
    Join Date
    Apr 2010
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I have only ever been able to do it with PHP, never with Javascript.

    And in the PHP code, I essentially write an IF statement that checks the "section" a certain page is (in an external array page), and if the section is true, then the PHP writes id="current" to the link.

    This is what my PHP code looks like:
    Code:
    <li><a <?php if ($pageID["section"]=="home") {echo "id=\"current\" ";} ?>href="index.php">Home</a></li>
    However, it can't be that difficult to redo in Javascript. I would think that if you made an id on every body tag, and then wrote a function that read against which id was which, that would do it.

    But I don't actually know enough about Javascript to write it out myself.
    Last edited by cmwagner; 06-22-2010 at 12:37 AM. Reason: Add PHP code

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

    Default

    I have exactly the same issue/requirement but have no PHP and only minimal JS. I'm able to pass a parameter through to the external submenu and read it using the script:

    var subMenuCurrent=location.search.substr(1).split("?");

    But then I have no idea of how to write the Javascript which, for each line in the submenu, would say:

    if subMenuCurrent = menuItemID, apply class="current" to this line.

    I'm losing sleep over this, 'cos I'm sure it should be easy!

    Thanks

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
  •