Animating background-color alpha channel: Firefox problem
I've created a script which toggles the alpha channel of an element's background-color:
- $('.button').click(function() {
- var bgcolor = $.Color($(this), 'background-color');
- var opac = bgcolor.alpha();
- opac = +!opac; bgcolor = bgcolor.alpha(opac);
- $(this).animate({backgroundColor: bgcolor}, 100);
- });
However, I have discovered that when the alpha channel is zero, the computed style
Firefox returns is the string "transparent" not the full RGBA value. Consequently, the returned Color object contains the RGB values
null,
null,
null.
This strikes me as a bug (in Firefox of course, not jQueryUI).
1) it is obfuscating valid style properties.
Does anyone know of a way around this issue - some kind of hack to get the true RGB values of an element that has opacity 0 that is cross-browser compatible?
Thanks