Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 8 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:

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

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

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by smiller.health

Attachment: offset.html added

Changed 10 years ago by smiller.health

Attachment: jquery-1.3.2.js added

comment:1 Changed 10 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 9 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.

http://help.dottoro.com/blog/ie7-zoom-level-problem-where-is-the-mouse-pointer/

Note: See TracTickets for help on using tickets.