Ticket #10669 (closed bug: fixed)
.animate() no longer animates percentage(%) width
| Reported by: | rudeboiidevil2k7@… | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | 1.7.1 |
| Component: | effects | Version: | 1.7 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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
comment:2 Changed 19 months ago by anonymous
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 19 months ago by timmywil
- Priority changed from undecided to high
- Status changed from new to open
- Summary changed from .animate() no longer animates % width to .animate() no longer animates percentage(%) width
- Component changed from unfiled to effects
- Milestone changed from None to 1.7.1
comment:6 Changed 19 months ago by nadim@…
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 19 months ago by dcz@…
Btw, the -/+= is not needed to loose the % :
Asked for 55%, got 55px on FF 7.0.1
comment:8 Changed 19 months ago by anonymous
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 19 months ago by timmywil
- Status changed from open to closed
- Resolution set to fixed
Add back unit in the width/height step function. Fixes #10669.
Changeset: 1e677f30f68d8ea41261aa666a9ba0720383e9d0
comment:10 Changed 19 months ago by dmethvin
#10713 is a duplicate of this ticket.
comment:11 Changed 19 months ago by dmethvin
#10716 is a duplicate of this ticket.
comment:12 Changed 19 months ago by dmethvin
#10775 is a duplicate of this ticket.
comment:13 Changed 19 months ago by timmywil
#10780 is a duplicate of this ticket.
comment:14 Changed 19 months ago by timmywil
#10795 is a duplicate of this ticket.
comment:15 Changed 18 months ago by timmywil
#10857 is a duplicate of this ticket.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This test was taken in Firefox 7 with Mac OS X 10.7.2.