Friday, March 4, 2011

jQuery offset function not working in IE - top is a IE keyword

The following piece of code is working fine in FF, Chrome, Opera but not in IE.  The error I got in IE says line 2 is 'Not Implemented'

left = $("#myElement").offset().left - 120;
top = $("#myElement").offset().top;     

It turns out that 'top' is a IE keyword. By saying top = ***, it implies set top position to ***, and this = operation is not implemented in IE.
So changed top to something else solved the problem.

This code is working in all browser:


rLeft = $("#myElement").offset().left - 120;
rTop = $("#myElement").offset().top;            

No comments :

Post a Comment