Modify ↓
Ticket #4724 (closed bug: wontfix)
Offset reporting incorrectly in IE7 on zoom level other than 100%
| Reported by: | smiller.health | Owned by: | brandon |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4 |
| Component: | offset | Version: | 1.3.2 |
| Keywords: | offset IE7 zoom | Cc: | |
| Blocking: | Blocked by: |
Description
I'm using jQuery 1.3.2 and seeing incorrect results in IE7 on the offset() call when the zoom level is set to anything other than 100%. As a result all elements positioned using data obtained by the results of offset() are placed in the wrong spot. Test case attached.
Attachments
Change History
comment:1 Changed 4 years ago by smiller.health
Here is my first pass at a workaround...
(function($){
$.fn.zoomOffset = function() {
var offset = $(this).offset();
var top = offset.top, left = offset.left;
var offsetMultiplier = 1;
if (document.body && document.body.getBoundingClientRect) {
var bound = document.body.getBoundingClientRect();
offsetMultiplier = parseFloat(Math.round(((bound.right - bound.left) / document.body.clientWidth) * 100)) / 100;
if (isNaN(offsetMultiplier)) {
offsetMultiplier = 1;
}
top = Math.round(top / offsetMultiplier),
left = Math.round(left / offsetMultiplier);
}
return { top: top, left: left, offsetMultiplier: offsetMultiplier };
};
})(jQuery);
comment:2 Changed 3 years ago by dmethvin
- Status changed from new to closed
- Resolution set to wontfix
This impacts just about every measurement in jQuery so I don't think we can fix it.
http://help.dottoro.com/blog/ie7-zoom-level-problem-where-is-the-mouse-pointer/
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

