Ticket #7984 (closed bug: invalid)
animate and fill property
| Reported by: | morgan.s134@… | Owned by: | morgan.s134@… |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | effects | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I have a bug when i try this :
$(this).animate({"fill": "black"}, "fast");
with the firefox's console i've :
Expected color, but 'NaNpx' find. Error of analysis of the value for 'fill'.
$(this).css("fill", "black"); works fine.
I use a SVG document
Change History
comment:2 Changed 2 years ago by addyosmani
- Owner set to morgan.s134@…
- Status changed from new to pending
comment:3 Changed 2 years ago by jitter
- Status changed from pending to closed
- Resolution set to invalid
- Component changed from unfiled to effects
I don't think this is a bug for the following reasons
- jQuery doesn't reliably support working with SVG at the current time as far as I'm aware. Check #7584 for progress on this issue.
- The animate() documentation says
All animated properties should be a single numeric value [...] properties that are non-numeric cannot be animated using basic jQuery functionality.
So currently you can't animate the fill property with jQuery core alone.
To get done what you want anyway, there are 2 options, which both include slightly adapting existing plugins so they support the fill property (adding the string fill to list of other color-related properties).
- For animating colors there is an offical jQuery color plugin
- If you are using jQuery 1.4.3+ you could also use the new cssHooks functionality. e.g. The jquery-cssHooks plugin already has a hook for color animation color.js
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 submitting a ticket to the jQuery Bug Tracker! Could you please also provide us with a reduced test case which reproduces the issue you're describing on http://jsFiddle.net?. This will assist us in fully evaluating the bug you're reported.