Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Genius needed: Modify a DD script

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

    Default Genius needed: Modify a DD script

    Hello there,

    I am using this script from Dynamic Drive:

    http://www.dynamicdrive.com/dynamici...anylinkcss.htm

    It's working fine but I want a little modification to make the drop down menu appears from the right side, not from the left.

    An image is attached within the post to clarify what I exactly failed to accomplish

    Your help would be greatly appreciated.
    Last edited by Snookerman; 06-12-2009 at 03:56 PM.

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

    Default

    Inside anylink.js, locate the line:

    Code:
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
    and change that to:

    Code:
    dropmenuobj.style.left=dropmenuobj.x-(dropmenuobj.offsetWidth-obj.offsetWidth)+"px"
    That should do it.

  3. #3
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    MANY THANKS. That's exactly what I need

    Can you tell me how can I center it, please?

  4. #4
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Good.

    Is it will compatible with RTL (Right to Left) ?

    I mean when we use <html dir="rtl"> or <div dir="rtl">..

    Thanks.

  5. #5
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Yep.

  6. #6
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    How to ?
    Please modify script for that.

  7. #7
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Just add: <html dir="rtl"> and...
    Quote Originally Posted by ddadmin
    Inside anylink.js, locate the line:

    Code:
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
    and change that to:

    Code:
    dropmenuobj.style.left=dropmenuobj.x-(dropmenuobj.offsetWidth-obj.offsetWidth)+"px"

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

    Default

    Hi ddadmin,

    I don't know whether you're still alive or not after all those years but I need your help again.

    This line doesn't exist in the new version:

    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"

    Please help, again.

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

    Default

    To do the same in v2.x of the script, try finding the below lines inside the .js file:

    Code:
    if (posx+this.dimensions.dropmenuw+this.effects.shadow.depth[0]>this.dimensions.docscrollx+this.dimensions.docwidth){ //drop left instead?
    	posx=posx-this.dimensions.dropmenuw + (menu.orientation=="lr"? -this.dimensions.anchorw : this.dimensions.anchorw)
    }
    and change that to just:

    Code:
    posx=posx-this.dimensions.dropmenuw + (menu.orientation=="lr"? -this.dimensions.anchorw : this.dimensions.anchorw)
    DD Admin

  10. The Following User Says Thank You to ddadmin For This Useful Post:

    Angry Coder (06-12-2009)

  11. #10
    Join Date
    Oct 2005
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    It worked. Thank you so much.

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
  •