Recently, I've been faced with an unusual challenge. I need to incorporate car turning lights functionality into my website. Specifically, I have to create a scenario where clicking either the left or right button triggers the corresponding green arrow to blink, mimicking a car's turning signals. The tricky part is figuring out how to manage the button's state and make sure the animation behaves as expected. Any insights on how to tackle this would be greatly appreciated. Thank you!
$("#arrow-left").click(function blinker() {
if(something) {
$('#arrow-left-blink').css("visibility", "visible");
$('#arrow-left-blink').fadeOut(500);
$('#arrow-left-blink').fadeIn(500);
setInterval(blinker, 1000);
} else {
//hide
}
}