Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#8834 closed bug (invalid)

Bug in offset changing in chrome during zoom

Reported by: [email protected] Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:


In chrome, changing element's offset during zoom out is buggy. For example, the following code which suppose to move a box one pixel right and one pixel down, doesn't work well when chrome is zoomed out:

<html> <head>

<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.5.2.min.js"></script>

<script type="text/javascript">

$(document).ready(function () {

$("#button1").click(function () {


top: $("#box").offset().top + 1, left: $("#box").offset().left + 1


$("#boxLocation").text($("#box").offset().top + "," + $("#box").offset().left);




</head> <body>

<div id="box" style="position:absolute; width: 100px; height:100px; left: 300; top:300; background-color:Red;"></div> <button id="button1">Test</button> Box location: <span id="boxLocation"></span>

</body> </html>

Change History (3)

comment:1 Changed 12 years ago by timmywil

Resolution: invalid
Status: newclosed

Thanks for taking the time to contribute to the jQuery project! Using a browser's zoom on a page produces unexpected behavior and cannot be expected to produce the same numbers.

comment:2 Changed 12 years ago by anonymous

Why not? I found a workaround for this problem, so it doesn't seem to be impossible to predict the behavior.
My workaround is:

document.getElementById("box").style.left = parseFloat(document.getElementById("box").style.left) + 1;
document.getElementById("box").style.top = parseFloat(document.getElementById("box").style.top) + 1;

comment:3 Changed 11 years ago by Rick Waldron

#11639 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.