Skip to main content

Bug Tracker

Side navigation

#11469 closed bug (fixed)

Opened March 13, 2012 01:54PM UTC

Closed March 21, 2012 07:34PM UTC

Last modified October 24, 2012 01:08PM UTC

Negative margin in animations (.animate)

Reported by: miskith Owned by: lrbabe
Priority: blocker Milestone: 1.7.2
Component: effects Version: 1.7.2rc1
Keywords: Cc:
Blocked by: Blocking:
Description
$(".class").animate({marginTop: -100}, 400);

This example doesn't work. It worked before 1.7.2rc1 and negative margin value is normal. Now when I use something like this script, animation dies and margin-top is 0px.

PS: It's not important that the example is with margin-top. Problem is with all margins (margin-* and margin).

Attachments (0)
Change History (9)

Changed March 13, 2012 01:56PM UTC by sindresorhus comment:1

owner: → miskith
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed March 13, 2012 02:03PM UTC by anonymous comment:2

Changed March 21, 2012 07:08PM UTC by lrbabe comment:3

milestone: None1.7.2
owner: miskithlrbabe
priority: undecidedblocker
status: pendingassigned

Changed March 21, 2012 07:12PM UTC by lrbabe comment:4

By fixing #11415 we broke the ability to animate margins to negative values.

Here's a PR that solves it without reverting completely the fix for #11415: https://github.com/jquery/jquery/pull/710

Changed March 21, 2012 07:34PM UTC by louisremi comment:5

resolution: → fixed
status: assignedclosed

Fix #11469. Exclude margins from the negative property check.

Changeset: 07c8a9b2448f42ee940e7fc1351344eb372f7463

Changed June 30, 2012 01:57AM UTC by anonymous comment:6

Replying to [ticket:11469 miskith]:

> $(".class").animate({marginTop: -100}, 400);
> 
This example doesn't work. It worked before 1.7.2rc1 and negative margin value is normal. Now when I use something like this script, animation dies and margin-top is 0px. PS: It's not important that the example is with margin-top. Problem is with all margins (margin-* and margin).

Changed July 10, 2012 09:34PM UTC by dmethvin comment:7

component: unfiledeffects

Changed October 24, 2012 09:57AM UTC by anonymous comment:8

Seems to me that the bug is still in the current version included. cant marginLeft to negative values

Changed October 24, 2012 01:08PM UTC by mikesherov comment:9

Thanks for contributing, anonymous. Please prove your claims with a test case. Thanks!