#10669 closed bug (fixed)
.animate() no longer animates percentage(%) width
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.7.1 |
Component: | effects | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
As of jQuery 1.6.4, the animate of using -=<percentage>% works just fine, but in jQuery 1.7, this fails to do so and animates in pixels.
$('div').animate({ width: '-=5%' });
If you test this in jQuery 1.6.4 with jsFiddle, if you inspect the element with Firebug it will show the width is in %.
Test: http://jsfiddle.net/HUfzX/
With jQuery 1.7 it animates with pixels, when inspecting the element, it shows the width in pixels not %
Change History (15)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
On Chrome, with 1.6.4 it works correctly, but with 1.7 it seems to use 40px instead of 40%, and as a result the width becomes 40 * 0.95
px.
comment:3 Changed 12 years ago by
Component: | unfiled → effects |
---|---|
Milestone: | None → 1.7.1 |
Priority: | undecided → high |
Status: | new → open |
Summary: | .animate() no longer animates % width → .animate() no longer animates percentage(%) width |
comment:6 Changed 12 years ago by
I can confirm this bug also occurred in my own webapp when tested on Chrome 15 and Chrome 16 beta on Mac OS X 10.7.2.
comment:7 Changed 12 years ago by
Btw, the -/+= is not needed to loose the % :
Asked for 55%, got 55px on FF 7.0.1
comment:8 Changed 12 years ago by
The issue is at jquery-1.7.js:8893
jQuery.style( fx.elem, prop, Math.max(0, fx.now) );
should be
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit);
comment:9 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Add back unit in the width/height step function. Fixes #10669.
Changeset: 1e677f30f68d8ea41261aa666a9ba0720383e9d0
This test was taken in Firefox 7 with Mac OS X 10.7.2.