Wednesday, April 11, 2012

jquery 1.7.2 bug?

I've a dom which is set to position: relative, style.left to 0

console.log($(target)); //return array of 1 object

$(target).css("left", "100px");
console.log(; //seems to return 100px, which is correct

but when i run
$(target).css("left"); // return 110px

$(target).position() - returns position from parent offset
$(target).offset() - returns position from the screen

The only work around method i could think of is to directly set:
position: relative;
top: 0;
left: 0;

Then use or directly.

Please note that this is tested on linux chromium browser 18.

No comments: