Bug Tracker

Modify

Ticket #10669 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

.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 %

Test:  http://jsfiddle.net/sWjXr/

Change History

comment:1 Changed 2 years ago by anonymous

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

comment:2 Changed 2 years 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 2 years 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:4 Changed 2 years ago by timmywil

#10681 is a duplicate of this ticket.

comment:5 Changed 2 years ago by timmywil

#10684 is a duplicate of this ticket.

comment:6 Changed 2 years 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 2 years ago by dcz@…

Btw, the -/+= is not needed to loose the % :

 http://jsfiddle.net/sWjXr/1/

Asked for 55%, got 55px on FF 7.0.1

comment:8 Changed 2 years 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 2 years 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 2 years ago by dmethvin

#10713 is a duplicate of this ticket.

comment:11 Changed 2 years ago by dmethvin

#10716 is a duplicate of this ticket.

comment:12 Changed 2 years ago by dmethvin

#10775 is a duplicate of this ticket.

comment:13 Changed 2 years ago by timmywil

#10780 is a duplicate of this ticket.

comment:14 Changed 2 years ago by timmywil

#10795 is a duplicate of this ticket.

comment:15 Changed 2 years 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.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.