Ticket #7399 (closed bug: invalid)
Animate Padding to Zero
| Reported by: | kevin@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.5 |
| Component: | unfiled | Version: | 1.4.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
The '.animate()' for padding always starts from zero pixel padding. A full description can be found here:
http://stackoverflow.com/questions/4095475/jquery-animate-padding-to-zero
Change History
comment:2 Changed 3 years ago by snover
- Status changed from new to closed
- Resolution set to invalid
I have updated the .animate documentation to match the .css documentation which states that shorthand properties are not supported.
comment:3 Changed 3 years ago by jitter
@snover Thanks for updating the documentation. But the copy-paste from the css() looks rather unfortunate. Maybe you should replace
For example, if you want to retrieve the rendered margin, use: $(elem).css('marginTop') and $(elem).css('marginRight'), and so on.
with
For example, if you want to animate the margin property, use
$(elem).animate({
'margin-top' : 10,
'margin-right' : 10,
'margin-bottom' : 10,
'margin-left' : 10
}, 1000);
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This bug doesn't happen for IE and Opera. But it shows in FF and Chrome.
This isn't an animate() bug but has to do with css().
test case
(Recently saw this) similar/related report #5526. Sometimes there seem to be problems with short-hand properties.
Instead of the workaround on stackoverflow you could also include the marginpadding.js from Brandon Aarons jQuery-cssHooks. This also fixes the problem
Your test case with jQuery-cssHooks