Skip to main content

Bug Tracker

Side navigation

#10669 closed bug (fixed)

Opened November 04, 2011 02:14PM UTC

Closed November 07, 2011 03:47PM UTC

Last modified March 08, 2012 08:47PM UTC

.animate() no longer animates percentage(%) width

Reported by: rudeboiidevil2k7@hotmail.co.uk 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 %

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

Attachments (0)
Change History (15)

Changed November 04, 2011 02:16PM UTC by anonymous comment:1

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

Changed November 04, 2011 03:17PM UTC by anonymous comment:2

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.

Changed November 05, 2011 06:00PM UTC by timmywil comment:3

component: unfiledeffects
milestone: None1.7.1
priority: undecidedhigh
status: newopen
summary: .animate() no longer animates % width.animate() no longer animates percentage(%) width

Changed November 05, 2011 06:00PM UTC by timmywil comment:4

#10681 is a duplicate of this ticket.

Changed November 05, 2011 06:06PM UTC by timmywil comment:5

#10684 is a duplicate of this ticket.

Changed November 05, 2011 06:52PM UTC by nadim@nadim.cc comment:6

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.

Changed November 06, 2011 12:54PM UTC by dcz@phpbb-seo.com comment:7

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

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

Asked for 55%, got 55px on FF 7.0.1

Changed November 07, 2011 01:42AM UTC by anonymous comment:8

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);

Changed November 07, 2011 03:47PM UTC by timmywil comment:9

resolution: → fixed
status: openclosed

Add back unit in the width/height step function. Fixes #10669.

Changeset: 1e677f30f68d8ea41261aa666a9ba0720383e9d0

Changed November 08, 2011 02:12PM UTC by dmethvin comment:10

#10713 is a duplicate of this ticket.

Changed November 08, 2011 02:12PM UTC by dmethvin comment:11

#10716 is a duplicate of this ticket.

Changed November 13, 2011 01:52PM UTC by dmethvin comment:12

#10775 is a duplicate of this ticket.

Changed November 13, 2011 08:45PM UTC by timmywil comment:13

#10780 is a duplicate of this ticket.

Changed November 15, 2011 04:58PM UTC by timmywil comment:14

#10795 is a duplicate of this ticket.

Changed November 22, 2011 04:38PM UTC by timmywil comment:15

#10857 is a duplicate of this ticket.