Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 11 years ago

#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:
Blocked by: Blocking:


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 (2)

offset.html (2.0 KB) - added by smiller.health 14 years ago.
jquery-1.3.2.js (117.9 KB) - added by smiller.health 14 years ago.

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by smiller.health

Attachment: offset.html added

Changed 14 years ago by smiller.health

Attachment: jquery-1.3.2.js added

comment:1 Changed 14 years ago by smiller.health

Here is my first pass at a workaround...

    $.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 };

comment:2 Changed 12 years ago by dmethvin

Resolution: wontfix
Status: newclosed

This impacts just about every measurement in jQuery so I don't think we can fix it.


Note: See TracTickets for help on using tickets.