Results 1 to 2 of 2

Thread: Menu opening in the wrong direction

  1. #1
    Join Date
    Oct 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Menu opening in the wrong direction

    1) Script Title: Flex Level Drop Down Menu (v1.1)

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

    3) Describe problem: I have the Menu on a Website on the upper side of the screen and most of the times it pops up normally, but sometimes it opens above the menu bar, "behind" the address-bar of the browser and out of the screen. This even happens when there are just 4 Menu entries and enough space under the menu bar.

    How can i set the Menu system to just open under the menu bar?

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

    Default

    To disable the menus from ever dropping up (so it always just drops down), inside the .js file, try locating function positionul(), and comment out the following two lines (added code in red):

    Code:
    	positionul:function($, $ul, e, $anchor){
    		var istoplevel=$ul.hasClass('jqflexmenu') //Bool indicating whether $ul is top level flex menu DIV
    		var docrightedge=$(document).scrollLeft()+$(window).width()-40 //40 is to account for shadows in FF
    		var docbottomedge=$(document).scrollTop()+$(window).height()-40
    		if (istoplevel){ //if main flex menu DIV
    			var offsets=$anchor.offset()
    			var anchorsetting=$anchor.data('setting')
    			var x=offsets.left+anchorsetting.useroffsets[0]+(anchorsetting.dir=="h"? $anchor.outerWidth() : 0) //x pos of main flex menu UL
    			var y=offsets.top+anchorsetting.useroffsets[1]+(anchorsetting.dir=="h"? 0 : $anchor.outerHeight())
    			x=(x+$ul.data('dimensions').w > docrightedge)? x-(anchorsetting.useroffsets[0]*2)-$ul.data('dimensions').w+$anchor.outerWidth()+(anchorsetting.dir=="h"? -($anchor.outerWidth()*2) : 0) : x //if not enough horizontal room to the ridge of the cursor
    			//y=(y+$ul.data('dimensions').h > docbottomedge)? y-(anchorsetting.useroffsets[1]*2)-$ul.data('dimensions').h-$anchor.outerHeight()+(anchorsetting.dir=="h"? ($anchor.outerHeight()*2) : 0) : y
    		}
    		else{ //if sub level flex menu UL
    			var $parentli=$ul.data('$parentliref')
    			var parentlioffset=$parentli.offset()
    			var x=$ul.data('dimensions').parentliw //x pos of sub UL
    			var y=0
    			x=(parentlioffset.left+x+$ul.data('dimensions').w > docrightedge)? x-$ul.data('dimensions').parentliw-$ul.data('dimensions').w : x //if not enough horizontal room to the ridge parent LI
    			//y=(parentlioffset.top+$ul.data('dimensions').h > docbottomedge)? y-$ul.data('dimensions').h+$ul.data('dimensions').parentlih : y
    		}
    		$ul.css({left:x, top:y})
    	},
    DD Admin

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
  •