I'm creating a small JavaScript API for my homepage with jQuery. At a point later in the code, I'm attaching an object containing css to an element via: $(element).css(theVariable);
The result should be equivalent to the following CSS code for example:
h3 {
background-color: rgb(0, 80, 0);
background-color: rgba(0, 80, 0.75);
}
How would I fill my theVariable so the effect when calling css(theVariable) is the same as the css-code above? I cannot use something like
theVariable = {};
theVariable['backgroundColor'] = 'rgb(0, 80, 0)';
theVariable['backgroundColor'] = 'rgba(0, 80, 0, 0,3)';
Since the RGBA value would always overwrite the RGB value.
Is there any way to circumvent this problem?