Results 1 to 3 of 3

Thread: Anylink drop down - 2 different heights on same page?

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

    Default Anylink drop down - 2 different heights on same page?

    1) Script Title: AnyLink Drop Down Menu

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

    3) Describe problem: I'm a complete novice here, so I'm hoping for some helpful advice from someone a lot cleverer than me!

    I'm using the anylink drop down menu, and in the code I've added a "+3" to the following line:

    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+3+"px"

    so that the dropdown appears a few pixels below my link/image. Trouble is, I'd like to have another link on my page where the menu appears above this second image link. I can amend the line of code to say -165 instead of +3 but this (obviously) changes every link.

    I realise that this may be too difficult to do (and therefore may not be answered!), but if anyone knows how this can be done I'd appreciate any help

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

    Default

    Actually, in this case, it's fairly simple to do. First, replace the original dropdownmenu() inside the script with the below version instead:

    Code:
    function dropdownmenu(obj, e, menucontents, menuwidth, offset){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
    clearhidemenu()
    dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
    populatemenu(menucontents)
    
    if (ie4||ns6){
    showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
    dropmenuobj.x=getposOffset(obj, "left")
    dropmenuobj.y=getposOffset(obj, "top")
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+(offset||0)+obj.offsetHeight+"px"
    }
    The above adds a new "offset" parameter you can use in your HTML, for example:

    Code:
    <a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '150px', -5)" onMouseout="delayhidemenu()">Web Design</a>
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    roblynch (09-30-2008)

  4. #3
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    ddadmin - brilliant! Can't tell you how grateful I am for your help - thanks very much!

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
  •