-4
Speak people, I have the following code to make a Blink effect in a div, I’m able to change the color of the background of the div from half to half a second, but I need to change the color of the text and I’m not able to find the logic for this change.
Follow the example of the current code
setInterval(function () {
$(".laranja").css("background-color", function () {
this.switch = !this.switch
return this.switch ? "rgb(0, 0, 0, 0.3)" : ""
});
}, 500)
I tried to do it like this and it worked
setInterval(function () {
$(".laranja").css("background-color", function () {
this.switch = !this.switch
return this.switch ? "rgb(0, 0, 0, 0.3)" : ""
});
$(".laranja").css("color", function () {
this.color = !this.color
return this.color ? "#FFF" : ""
});
}, 500)
But I don’t know if it’s the cleanest and right way to go.
I’ll use your version, it seems to be lighter than mine
– Patrique