Results 1 to 3 of 3

Thread: Pop-up, not pop-down menus

  1. #1
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Pop-up, not pop-down menus

    I'm using this code on my site:
    http://www.dynamicdrive.com/dynamici...pmenuindex.htm

    but I want to modify it so that the menu pops above the link. One thing to keep in mind is that I may have menus of different lengths, but the all must share the same bottom value so they start at the same point above the link. I've pored over the code for a while, but I'm a little lost at this point. Can anyone offer any advice? Thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Find this line:

    Code:
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    Change it to this:

    Code:
    dropmenuobj.style.top=dropmenuobj.y+clearbrowseredge(obj, "bottomedge")-dropmenuobj.offsetHeight+"px"
    If you would like the menus to drop down when there isn't enough room for them to drop up, find these lines:

    Code:
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
    edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
    if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
    edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
    Change them to this:

    Code:
    if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) {//up no good?
    edgeoffset=dropmenuobj.y+(0.4*obj.offsetHeight)+dropmenuobj.offsetHeight-topedge
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) //move up?
    edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
    - John
    ________________________

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

  3. #3
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you! That worked perfectly.

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
  •