Opened 14 years ago
Closed 14 years ago
#4635 closed bug (duplicate)
Colour Animations cannot animate to transparent
Reported by: | willearp | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.8 |
Component: | ui.effects.core | Version: | 1.7.2 |
Keywords: | color animation | Cc: | |
Blocked by: | Blocking: |
Description
Effects.core.js cannot animate from the specified colour to transparent, which causes "Invalid Property Value" errors in IE7 and IE8. (FF seems to cope).
The library already has a function to look up the parent tree for the next value of the specified attribute, so the solution is to check whether fx.end is transparent and if it is, to lookup the next parent value using getColor(). Also it should only use "backgroundColor" as the attribute to retieve, as when looking up borders, the resulting parent color is black when the border width is 0. The code is as follows:
After:
fx.start = getColor( fx.elem, attr );
Add:
if (fx.end == "transparent") fx.end = getColor(fx.elem.parentNode, "backgroundColor");
Note: The fix for where fx.state could be greater than 0 even when fx.start and fx.end have not been initialised helps Internet Explorer's problems with this plugin too.
Change:
if (fx.state == 0) {
To:
if (fx.state == 0 || fx.start.constructor != Array || fx.end.constructor != Array) {
Change History (3)
comment:1 Changed 14 years ago by
Component: | ui.core → effects.core |
---|---|
Milestone: | TBD → 1.8 |
comment:2 Changed 14 years ago by
Actually I find it quite useful when animating backgrounds and borders on and off when you don't know what the colour you are animating to is, and it uses the function you already have for looking up parent colours, so all it is really doing is converting "transparent" to the next available colour.
Animating to some other color is certainly not a valid solutions for animating to transparent.