Javascript Dropdown Menus?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MGM
    Senior Member
    • Aug 2002
    • 3653
    • 3.6.x

    Javascript Dropdown Menus?

    I'd like to add something similar to vB's onclick dropdown menus, but not use Jelsoft's work unless neccesary. Is there anywhere I can go to find such a (prebuilt) menu? Or perhaps a tutorial I can follow to make my own?

    EDIT: I found this which is almost exactly what I want, but I'd like it to be an onclick event rather than a mouseover. Looking at the code it seems to be all in css and so probably cant be changed to onclick without javascript...

    MGM out
    Last edited by MGM; Sat 19 Aug '06, 5:23pm.
  • daemon
    Senior Member
    • Jun 2003
    • 2351
    • 3.5.x

    #2
    You could probably keep that code but instead of move the :hover CSS code out of the CSS file and then just use JavaScript to style it instead. For instance, let's say this was their CSS:

    Code:
    .menu:hover
    {
        color: #ff0;
        background: #efefef;
    }
    Then you'd move that into a JavaScript like this:

    Code:
    function open_menu(menu)
    {
         menu.style.color = "#ff0";
         menu.style.background = "#efefef";
    }
    You'd call that from an onClick event and would have to pass the menu element to it. But if you played around with it, it could work (in theory).
    Bugdar: PHP bug tracking software that is beautiful, fast, and robust.

    Comment

    • MGM
      Senior Member
      • Aug 2002
      • 3653
      • 3.6.x

      #3
      Unfortunately I'm not that great at Javascript... Is there any way you could provide more help or direct to some place where I can get more help?

      MGM out

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...