Results 1 to 6 of 6

Thread: Get offset

  1. #1
    Join Date
    Dec 2004
    Location
    Nelspruit South Africa
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Get offset

    Can some one explain this to me and also how I could modify the positioning based on this or a variant thereof please.

    I need to know what this is doing line by line and how to move the drop down say 65 pixels left and 85 pixels up. This is from the Drop down menu script.

    function getposOffset(what, offsettype){
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }

  2. #2
    Join Date
    Dec 2004
    Location
    Nelspruit South Africa
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default why bother to have

    a forum if no one answers any questions?

  3. #3
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Which script are you using? Please provide a link.

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  4. #4
    Join Date
    Dec 2004
    Location
    Nelspruit South Africa
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

  5. #5
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Find these 2 lines:
    Code:
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    And change them to this:
    Code:
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+50+"px"
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+50+obj.offsetHeight+"px"
    Which will add 50 to the position from left and 50 top position from top. To make it 65px to the left and 85px up as you suggested, you could do this:
    Code:
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")-65+"px"
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")-85+obj.offsetHeight+"px"
    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  6. #6
    Join Date
    Dec 2004
    Location
    Nelspruit South Africa
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thank you

    Dankie
    Siya bonga
    Obrigado
    Vielen Dank
    Merci

    and as many otherways as it is possible to say so.

    Afrikaans
    Zulu
    Portuguese
    German
    French

    and a Frohe Weinachten to you as well

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
  •