Advanced Search

Results 1 to 7 of 7

Thread: Mega Menu Drop downs positioning

  1. #1
    Join Date
    Dec 2012
    Location
    Australia
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Mega Menu Drop downs positioning

    1) Script Title: ddmegamenu.js

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

    3) Describe problem: My issue is the drop downs are anchored to the parent items but I need them to be anchored to the left edge of the main menu as I need them to be the same width as the main menu. Is this possible with this script?

    I am building this menu here [broken link removed]

    Is this possible?

    PS. I had posted a similar thread last month but it hasn't gotten any replies recently so I thought I would post again.
    Last edited by jscheuer1; 01-28-2013 at 07:33 PM. Reason: remove broken link

  2. #2
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    47
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Hi Ptron,
    Unfortunately the link to your site is broken, it says:
    Sorry that page no longer exists
    A to the question, I'm not really sure what you mean, a quick diagram in ms paint could go a long way in explaining what you want.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,690
    Thanks
    43
    Thanked 3,129 Times in 3,095 Posts
    Blog Entries
    12

    Default

    Have you edited the script? Looks like you have but that the negative left style that creates has no effect:

    Code:
    				var os=(/\[base\]/.test($anchor.attr('rel'))?-this.parentNode.offsetLeft:0) //check for rel="submenuid[left]" to indicate submenu should be based to the left of the parent
    				$submenu.wrap('<div class="megawrapper" style="z-index:'+ddmegamenu.startzindex+';position:absolute;top:0;left:0;visibility:hidden"><div style="position:absolute;overflow:hidden;left:'+(os)+';top:0;width:100%;height:100%;"></div></div>')
    Even if it did work, I think it would need adjustment as the negative values it's generating are too great, which if it worked would result in the menu appearing too far to the left. But to have any effect at all the units (px in this case) must be specified, in the second line from the above, this part:

    Code:
     . . . ow:hidden;left:'+(os)+';top:0;wi . . .
    should be:

    Code:
     . . . ow:hidden;left:' + os + 'px;top:0;wi . . .
    Once you have that, to get it to line up correctly, I would try changing the first line to:

    Code:
    var os=(/\[base\]/.test($anchor.attr('rel'))?-this.parentNode.offsetLeft+$mainmenu.offset().left:0)
    - John
    ________________________

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

  4. #4
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,707
    Thanks
    2
    Thanked 388 Times in 383 Posts

    Default

    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,690
    Thanks
    43
    Thanked 3,129 Times in 3,095 Posts
    Blog Entries
    12

    Default

    .
    Your page is in violation of Dynamic Drive's usage terms, which, among other things, state that the script credit must appear in the source code of the page(s) using the script. Please reinstate the notice first.

    That said, I tested my theory and it works but there's a horizontal scrollbar. So I changed it a little. those two lines from my first post:

    Code:
    				var os=(/\[base\]/.test($anchor.attr('rel'))?-this.parentNode.offsetLeft:0) //check for rel="submenuid[left]" to indicate submenu should be based to the left of the parent
    				$submenu.wrap('<div class="megawrapper" style="z-index:'+ddmegamenu.startzindex+';position:absolute;top:0;left:0;visibility:hidden"><div style="position:absolute;overflow:hidden;left:'+(os)+';top:0;width:100%;height:100%;"></div></div>')
    should be changed to:

    Code:
    				var os=(/\[base\]/.test($anchor.attr('rel'))?-this.parentNode.offsetLeft+$mainmenu.offset().left:0) //check for rel="submenuid[left]" to indicate submenu should be based to the left of the parent
    				$submenu.wrap('<div class="megawrapper" style="z-index:'+ddmegamenu.startzindex+';margin-left:'+os+'px;position:absolute;top:0;left:0;visibility:hidden"><div style="position:absolute;overflow:hidden;left:0;top:0;width:100%;height:100%;"></div></div>')
    Or you can download the edited script (right click and 'Save As'):

    ddmegamenu.js

    and use that instead of your current version.

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

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

  6. #6
    Join Date
    Dec 2012
    Location
    Australia
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John thank you for your help.

    Yes I had been playing around with the code a little bit based on stuff I could find online.
    This is just my test page credit has been reinstated but will also be on the actual live site when its done.

    I will test out your suggestions and let you know, thanks again.

    Hi vwphillips, your demo looks like what I need with mine thank you for sharing.

    Hi bernie1227 sorry my bad I was actually using the 404 page as a demo, soffr for the confusion.

  7. #7
    Join Date
    Dec 2012
    Location
    Australia
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi John,

    just wanted to let you know that I have implemented your changes and they work perfectly. Thank you I really appreciate your help.

    Cheers

Similar Threads

  1. DD mega menu positioning
    By pase in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 08-26-2011, 09:37 PM
  2. DD Mega Menu Positioning?
    By Xar in forum Dynamic Drive scripts help
    Replies: 7
    Last Post: 07-30-2011, 04:25 PM
  3. Positioning of drop downs - HELP
    By BlueOsyterCult in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 08-27-2007, 04:38 AM

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
  •