Results 1 to 6 of 6

Thread: DD mega menu positioning

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

    Default DD mega menu positioning

    1) Script Title:
    DD Mega Menu

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

    3) Describe problem:
    I am trying to figure out the positioning for the individual drop down boxes. Can the drop down menu boxes be positioned individually left, right, center and random points?
    thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    9,890
    Thanks
    3
    Thanked 964 Times in 953 Posts
    Blog Entries
    15

    Default

    Each drop down box can be individually placed to the left or right of the anchor link (but beyond that not arbitrarily). To do this, you'd just make use of the syntax highlighted below in the markup for your anchors:

    Code:
    <ul id="solidmenu" class="solidblockmenu">
    <li><a href="http://www.dynamicdrive.com/">Home</a></li>
    <li><a href="http://www.javascriptkit.com" rel="jkmenu">JavaScript v</a></li>
    <li><a href="http://www.dynamicdrive.com/forums/">Forums</a></li>
    <li><a href="http://tools.dynamicdrive.com">Webmaster Tools</a></li>
    <li><a href="http://www.cssdrive.com" rel="cssdrivemenu[left]">CSS Drive v</a></li>
    </ul>
    The "left" suffix here will cause the associated drop down menu to drop down to the left of the anchor link in question.
    DD Admin

  3. #3
    Join Date
    Aug 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks, I am able to place the box on the left or right of the anchor point. Is it possible to move the anchor points to achieve a custom box placement?

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Quote Originally Posted by ddadmin
    Each drop down box can be individually placed to the left or right of the anchor link (but beyond that not arbitrarily).
    Custom placements won't be possible without modifying the code. It could be possible to use something like (just an example) custom=50 like the "left" tag. This would (in theory) offset it 50 pixels. But you would need to modify the script itself to interpret "custom" like it interprets "left" and then add a way to interpret the "50" as well. Is this required? You might want to post this in the DD scripts paid work requests forum, near the bottom of the main forum page.



    EDIT: If you do want to attempt to modify the script to handle this, you would need to modify two lines (probably duplicating them to handle the additional "custom" option):
    You would need to check for the "custom" option in addition to left here:
    Code:
    var orienttoleft=/\[left\]/.test($anchor.attr('rel')) //check for rel="submenuid[left]" to indicate submenu should be left aligned
    This line handles the actual positioning. You'd need to add a third condition (custom) and account for it here:
    Code:
    $wrapper.css({visibility:'visible', left:offset.left-(orienttoleft? $wrapper.outerWidth()-$anchor.outerWidth()-ddmegamenu.wrapperoffset[0] : 0), top:offset.top+$anchor.outerHeight(), zIndex:++ddmegamenu.startzindex})
    Note that you would need to determine the pixel value (eg 50) and store that, probably when reading the 'custom' tag initially. Then you'd use that to modify the CSS properties.

    By the way, I'd recommend two options: positive numbers (like 50) are offset from the right, and negative numbers (like -50) are offset from the left. That would give maximum freedom.
    (Of course once that was in place you would no longer need the "left" (or even default) positioning-- you could just use 0 and -0 if you want.)
    Last edited by djr33; 08-25-2011 at 07:26 PM.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Aug 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I would like to attempt to modify the script. I found the 2 js code lines, duplicated them and changed the "left" position to "custom". I also changed the anchor tag [left] to [custom=50] in the html page. Can you advise where to store the value "50" in the js and css. thanks!

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    If you don't have experience editing Javascript, then you may need someone to hire to make this modification for you. It will be a substantial change in the script (though not too difficult for an experienced Javascript coder). I explained the methods above, and I don't have time at the moment to actually do all of the changes required. Note that you will not need to modify the CSS, but just the Javascript because you can (dynamically) change CSS style values through Javascript.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •