I came across this just the other day, but the solution I was looking for would ideally not have me define the background colour in both the CSS and JavaScript. In the end I managed to solve it by using the "getComputedStyle" function, and then modifying the alpha value as required.
In my scenario I was trying to fade in the background:
For this to work I'm working on the assumption that "getComputedStyle" will return me an rgb string for the background colour. I'm currently trying to figure out whether this is a safe assumption to make.
background transparency only
in GSAP
Posted
Note: The following does not work in IE8
I came across this just the other day, but the solution I was looking for would ideally not have me define the background colour in both the CSS and JavaScript. In the end I managed to solve it by using the "getComputedStyle" function, and then modifying the alpha value as required.
In my scenario I was trying to fade in the background:
For this to work I'm working on the assumption that "getComputedStyle" will return me an rgb string for the background colour. I'm currently trying to figure out whether this is a safe assumption to make.