Bug Tracker

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#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:
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).

Change History (9)

comment:1 Changed 4 years ago by sindresorhus

  • Owner set to miskith
  • Status changed from new to pending

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.

comment:3 Changed 4 years ago by lrbabe

  • Milestone changed from None to 1.7.2
  • Owner changed from miskith to lrbabe
  • Priority changed from undecided to blocker
  • Status changed from pending to assigned

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

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Changeset: 07c8a9b2448f42ee940e7fc1351344eb372f7463

comment:6 in reply to: ↑ description Changed 4 years 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).

comment:7 Changed 4 years ago by dmethvin

  • Component changed from unfiled to effects

comment:8 Changed 4 years ago by anonymous

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

comment:9 Changed 4 years ago by mikesherov

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

Note: See TracTickets for help on using tickets.