I'm trying to fade the background-color of a span tag using JQuery to emphasize when a change has occured. I was thinking the code would be someting like the following inside the click handler, but I can't seem to get it working. Can you show me where I went wrong? Thanks Russ.
$("span").fadeOut("slow").css("background-color").val("FFFF99");
That's better, but now it fades both the background-color of the span tag and the text value of the span tag too. I'm trying to just fade the background-color and leave the text visible. Can that be done?
jQuery code to set the background color of all span elements to blue? A. $(“span”). style(“background-color”,”blue”);
The jQuery fadeIn() method is used to fade in a hidden element. Syntax: $(selector). fadeIn(speed,callback);
fadeIn() function fades in our first image in 1500 milliseconds (or, 1.5 seconds). The . delay() function acts as a counter and waits 3500 milliseconds (or, 3.5 seconds), then the . fadeOut() function fades it out in 1500 milliseconds (or, 1.5 seconds).
It can be done with the color animation plugin. You'd then do something like
$('span').animate({'backgroundColor' : '#ffff99'});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With