Skip to main content

Bug Tracker

Side navigation

#4724 closed bug (wontfix)

Opened June 03, 2009 09:06PM UTC

Closed November 17, 2010 04:13AM UTC

Last modified March 13, 2012 06:55PM UTC

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)
  • jquery-1.3.2.js (117.9 KB) - added by smiller.health June 03, 2009 09:06PM UTC.
  • offset.html (2.0 KB) - added by smiller.health June 03, 2009 09:06PM UTC.
Change History (2)

Changed June 03, 2009 10:39PM UTC by smiller.health comment:1

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);

Changed November 17, 2010 04:13AM UTC by dmethvin comment:2

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/