Is there a way (keeping forward-compatibility in mind) to force jQuery animations to use only integer values amidst an animation?
I'm animating an element's width.
<div style="width: 25px">...</div>
I look at the element in the inspector while it's in the middle of animating, and often the value has massive granularity decimalwise.
<div style="width: 34.24002943013px">...</div>
It only 'calms down' to integers once it's reached its goal.
<div style="width: 50px">...</div>
Usually I wouldn't bother myself about this as it's obviously functional.
However, in this project it's imperative that I stay pixel-perfect at all times, and I'm afraid using fractional pixel widths (or any other attribute measured in pixels) would render inconsistently between browsers. I know letter-spacing
for one does.
Is there a way to make sure jQuery only uses decimal-free values even in the middle of animation?
EDIT: I feel like I should clarify; I'm not just using .animate({width:50})
. Most of my animations are jQuery UI -powered .hide()
s and .show()
s, and the solution I'm looking for should obviously also work with those.