Does anyone know of a lightweight (small file size) HTML background color fader?
Something like the below pseudo-JavaScript
fadeDiv('div_element_to_fade','hex_start_color','hex_end_color','speed_of_fade');
Does anyone know of a lightweight (small file size) HTML background color fader?
Something like the below pseudo-JavaScript
fadeDiv('div_element_to_fade','hex_start_color','hex_end_color','speed_of_fade');
You could use this solution.
This uses jquery. I highly recommend that you start using this instead of plain javascript
Another solution:
$("#go").click(function(){
$(".block").animate( { backgroundColor: 'pink' }, 1000)
.animate( { backgroundColor: 'blue' }, 1000);
});
To call it how you want:
function animateColorsCustom(){
$(".block").animate( { backgroundColor: 'pink' }, 1000)
.animate( { backgroundColor: 'blue' }, 1000);
}
function otherFunction(){
animateColorsCustom();
}
Maybe my answer is a bit OFF, but, If I were you, I'd definitely go with the JQuery way
Try this Background Fade or this Background Fader or this Fade The Background Color