Menu

#2 Built-in Support For Popup Menu

open
nobody
5
2006-08-24
2006-08-24
GaryO
No

The JSCookMenu's are really cool. I plan to use them
not only for menu's but also for DIV-based Options
controls as well. The other thing I have been trying
to use, is for popup menu's. I was mostly successful
in doing this...and is really quite simple... I did
the following:

First, create a JS function like so:

function showPopupMenu(srcElement, menu)

Within this function, I:

1) Dynamically create a DIV
2) Use the cmDraw to have JSCookMenu draw the menu
subsystem into it
3) Position my dynamically created DIV relative to
the srcElement passed in (I acutally would like to
support position instead so that someone could
implement popping up relative to the mouse pointer in
the future)
4) I set the visibility of the DIV to "visible"
5) I add an onclick handler to the document.body so
that when someone clicks the body...anywhere, I can
destroy the DIV

This mostly works. The problem I am having is fully
mimic'ing what you have done when you draw and
position submenu's. I don't have IFrame Masking yet,
so Option controls show through my DIV. Also, with
the latest JSCookMenu (2.0.1), it doesn't like that
my DIV is absolutely positioned either so my sub-
menu's do not work... Finally, when the sub-menu
shows up...and is located near the edge of the
browser, it doesn't position the submenu
properly... :(

I will be trying to fix all these, but if there was
any way to build the above function *into* what you
have, it truly would become a even more powerful
object.

Discussion

  • GaryO

    GaryO - 2006-08-24

    Newer version with IFrame Masking and Sub-menu's Working

     
  • GaryO

    GaryO - 2006-08-24

    Logged In: YES
    user_id=1578363

    I attached a new version of my popup source. I got the
    IFrame masking to work (using your example) and also fixed
    my problem with sub-menu's (I had a bad zindex on the
    main, popup DIV). The only thing I can't fix is the first
    sub-menu item comes up off the screen. It has something
    to do with the fact (I think) that I had to make my popup
    DIV be width=100% to make submenu's show up.

     

Log in to post a comment.