Jump to content

offsetLeft Firefox Problems


eddy556

Recommended Posts

I have a problem with the offsetLeft function in Firefox, it gives out different numbers than in IE.  After a bit of research I have found out that this is very well known however I have yet to find a proper solution.

 

This is my code (works in IE), is there any way this could be converted to work in both?

 

function findPos(obj) 
{
    
    var curleft = curtop = 0;

    if (obj.offsetParent)
    {
        curleft = obj.offsetLeft;
       
        curtop = obj.offsetTop;

        while (obj = obj.offsetParent)
        {
        curleft += obj.offsetLeft;
        curtop += obj.offsetTop;
        }
    }
       
    return [curleft,curtop];
}

Link to comment
https://forums.phpfreaks.com/topic/155333-offsetleft-firefox-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.