#2681 closed bug (duplicate)
offsetLeft and offsetTop off by 2 pixels in MSIE7
Reported by: | iconico | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.4 |
Component: | core | Version: | 1.2.3 |
Keywords: | position | Cc: | |
Blocked by: | Blocking: |
Description
If I get the offsetLeft and offsetTop in IE7 they start at 2pixels, in Firefox they correctly start at 0 pixels:
<script> jQuery(document).ready(function(){
$("#special").mousemove(function(e){
var x = e.pageX - this.offsetLeft; var y = e.pageY - this.offsetTop;
$('#status2').html(x +', '+ y);
});
}) </script>
<h2 id="status2"> 0, 0 </h2> <div style="margin-left:100px; width: 100px; height: 100px; background:#ccc;" id="special"> Click me anywhere! </div>
Note: See
TracTickets for help on using
tickets.
Duplicate of #2247