Results 1 to 3 of 3

Thread: Problem with Pop-it menu script

  1. #1
    Join Date
    Feb 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem with Pop-it menu script

    1) Script Title:
    Pop-it menu

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamicindex1/popit.htm

    3) Describe problem:
    Can you tell me how I can alter the script so that the menu does not float with the mouse but just drops straight down from the bottom of the tab?

    code:

    Code:
    /***********************************************
    * Pop-it menu- © Dynamic Drive (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    var defaultMenuWidth="180px" //set default menu width.
    
    var linkset=new Array()
    //SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT
    
    linkset[0]='<a href="about.htm">About Our Agency</a>'
    linkset[0]+='<a href="services.htm">Services & Products</a>'
    linkset[0]+='<a href="companies.htm">Our Companies</a>'
    linkset[0]+='<a href="quote.htm">Get-a-Quote</a>'
    
    
    
    linkset[1]='<a href="contact.htm">Contact Us</a>'
    linkset[1]+='<a href="claims.htm">Report a Claim</a>'
    linkset[1]+='<a href="payment.htm">Payments</a>'
    linkset[1]+='<a href="personal_lines.htm">Personal Lines Forms</a>'
    linkset[1]+='<a href="companies.htm">Companies Represented</a>'
    linkset[1]+='<a href="registry.htm">In House Registry Service</a>'
    linkset[1]+='<a href="information.htm">Information</a>'
    linkset[1]+='<a href="quote.htm">Get-a-Quote</a>'
    
    linkset[2]='<a href="personal.htm">Personal Insurance</a>'
    linkset[2]+='<a href="products.htm">Products</a>'
    linkset[2]+='<a href="discounts.htm">Discounts</a>'
    linkset[2]+='<a href="companies.htm">Our Companies</a>'
    linkset[2]+='<a href="personal_lines.htm">Forms/Resources</a>'
    linkset[2]+='<a href="quote_other.html">Get-a-Quote</a>'
    
    linkset[3]='<a href="companies.htm">Our Companies</a>'
    linkset[3]+='<a href="certificate.htm">Certificate Request</a>'
    linkset[3]+='<a href="quote_other.html">Get-A-Quote</a>'
    
    ////No need to edit beyond here
    
    var ie5=document.all && !window.opera
    var ns6=document.getElementById
    
    if (ie5||ns6)
    document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')
    
    function iecompattest(){
    return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
    }
    
    function showmenu(e, which, optWidth){
    if (!document.all&&!document.getElementById)
    return
    clearhidemenu()
    menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
    menuobj.innerHTML=which
    menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
    menuobj.contentwidth=menuobj.offsetWidth
    menuobj.contentheight=menuobj.offsetHeight
    eventX=ie5? event.clientX : e.clientX
    eventY=ie5? event.clientY : e.clientY
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
    var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<menuobj.contentwidth)
    //move the horizontal position of the menu to the left by it's width
    menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
    else
    //position the horizontal position of the menu where the mouse was clicked
    menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
    //same concept with the vertical position
    if (bottomedge<menuobj.contentheight)
    menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
    else
    menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
    menuobj.style.visibility="visible"
    return false
    }
    
    function contains_ns6(a, b) {
    //Determines if 1 element in contained in another- by Brainjar.com
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
    }
    
    function hidemenu(){
    if (window.menuobj)
    menuobj.style.visibility="hidden"
    }
    
    function dynamichide(e){
    if (ie5&&!menuobj.contains(e.toElement))
    hidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    hidemenu()
    }
    
    function delayhidemenu(){
    delayhide=setTimeout("hidemenu()",500)
    }
    
    function clearhidemenu(){
    if (window.delayhide)
    clearTimeout(delayhide)
    }
    
    if (ie5||ns6)
    document.onclick=hidemenu
    
    </script>
    Last edited by ddadmin; 02-27-2012 at 06:27 AM.

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

    Default

    In that case take a look at the following two menu scripts instead:

    http://www.dynamicdrive.com/dynamici...pmenuindex.htm
    http://www.dynamicdrive.com/dynamici...exdropdown.htm
    DD Admin

  3. #3
    Join Date
    Feb 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you!! The Flex Drop Down Menu solved my problem. I am grateful for this help!!!

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
  •