Ticket #11469 (closed bug: fixed)
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: | ||
| Blocking: | Blocked by: |
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).
Change History
comment:1 Changed 15 months ago by sindresorhus
- Owner set to miskith
- Status changed from new to pending
comment:3 Changed 14 months ago by lrbabe
- Owner changed from miskith to lrbabe
- Priority changed from undecided to blocker
- Status changed from pending to assigned
- Milestone changed from None to 1.7.2
comment:4 Changed 14 months ago by lrbabe
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
comment:5 Changed 14 months ago by louisremi
- Status changed from assigned to closed
- Resolution set to fixed
Fix #11469. Exclude margins from the negative property check.
Changeset: 07c8a9b2448f42ee940e7fc1351344eb372f7463
comment:6 in reply to: ↑ description Changed 11 months ago by anonymous
Replying to 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).
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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.