Results 1 to 4 of 4

Thread: Need to force drop down menu to only drop down.....not up

  1. #1
    Join Date
    Aug 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need to force drop down menu to only drop down.....not up

    1) Split Menu Buttons v1.2

    2) http://www.dynamicdrive.com/dynamici...enubuttons.htm

    3) I currenty am trying to use this drop menu in a frame and because of that I think it is causing the menu to drop up. Is there a way to force the menu to only drop down and make the z-index open it up over everything?

    thanks in advance

  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

    Using a text only editor like NotePad, in the splitmenubuttons.js script, find this function:

    Code:
    	function positionmenu(s, level, $toggler, $dropmenu){
    		if (level == "toplevel"){
    			var docrightedge = $(document).scrollLeft() + $(window).width() - 40
    			var docbottomedge = $(document).scrollTop()+$(window).height()-40
    			this.docrightedge = docrightedge // cache this value
    			this.docbottomedge = docbottomedge
    			var $offset = $toggler.data('mainanchor').offset()
    			var togglerWidth = (s.split)? $toggler.data('mainanchor').width() + $toggler.width() : $toggler.width()
    			var togglerHeight = $toggler.height()
    			var dropmenuWidth = $dropmenu.outerWidth()
    			var dropmenuHeight = $dropmenu.outerHeight()
    			var leftpos = (($offset.left + dropmenuWidth) > docrightedge)? $offset.left - (dropmenuWidth - togglerWidth) : $offset.left
    			var toppos = (($offset.top + dropmenuHeight) > docbottomedge)? $offset.top - (dropmenuHeight + togglerHeight) : $offset.top
    			return {left: leftpos, top: toppos}
    		}
    		else{
    			var $offset = $toggler.offset()
    			var submenuWidth = $dropmenu.outerWidth()
    			var submenuHeight = $dropmenu.outerHeight()
    			var leftpos = ($offset.left + (submenuWidth*2) > this.docrightedge)? -submenuWidth : submenuWidth
    			var toppos = ($offset.top + (submenuHeight) > this.docbottomedge)? -submenuHeight + $toggler.height() : 0
    			return {left: leftpos, top: toppos}
    		}
    	}
    Change the highlighted line to:

    Code:
    			var docbottomedge = 99999999
    Save and use that version of the script.

    The browser cache may need to be cleared and/or the page refreshed to see changes.

    I'm not sure what you mean about the z-index. If you mean that you want the menu to drop over the iframe border, z-index will not do that. There is a fellow on here who has code for that sort of thing though, hopefully he will reply.

    But my approach would be, instead of an iframe, I would use either a server side include (if available) or AJAX.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

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

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    That fellow is me.
    Please send me a link to your site or the source of your page so that I can see what we can do about the matter.
    It's tricky, but possible.
    Are you talking about the frame of a frameset, or about an iframe?
    Note that the options of regular drop downs (select boxes) drop over the (i)frame border just by themselves.

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    I forgot to give you a site where regular dropdowns are used to accomplish what you want. Here's the url.
    If you think the site looks good enough, I would advise you to use standard drop downs (or a server side include, of course).

Similar Threads

  1. Force drop up all the time instead of auto up/down per size of browser.
    By gotoplanf in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 06-08-2011, 04:48 AM
  2. Anylink drop down menu - Demo #3 (sub menus drop to the right of anchor):
    By pjdcreative in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-17-2010, 02:54 AM
  3. Force menu to drop down
    By skeep in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 02-07-2010, 04:00 AM
  4. Chrome Drop Down Menu Script - 2nd level drop downs?
    By mdbiker in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 10-27-2006, 02:44 PM
  5. AnyLink Drop Down Menu - force drop down
    By ddf_al in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 12-14-2005, 02:16 PM

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
  •