Hi all,
i want get the element postion using javascript. it work as i am using below
javascript method. but when i change the browser resolution then it give me the
element position correct. it always calculated the position acording to
width: 1024 and height:800
How to caluclate the postion according to resolution?
function GetPosition(sender) {
var offsetTrail = sender;
var offsetLeft = 0;
var offsetTop = $(sender).outerHeight();
var p;var count = 0;
while (offsetTrail) {
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
p = offsetTrail;count = count + 1;
offsetTrail = offsetTrail.offsetParent;
}
if (sender.style.marginLeft != '')
offsetLeft = offsetLeft - parseInt(sender.style.marginLeft.replace('px',''));
return { x: offsetLeft , y: offsetTop };
}