I’m my question is simple, but it is eluding me greatly. I’m using a jquery function to make an element flash while a variable is false, and hide when true:
function flasher(bl){
if(!bl){
setInterval(function(){
$(".flash").fadeToggle("slow");
}, 300);
}
}
var bl = false;
$(document).ready(function(){
$(".flash").on("hover", function(){
bl = true;
});
flasher(bl);
});
When I use alert, it does show the function running and I get true, but I’m unable to see my mistake in this. Using firebug the value of bl stays false. I’ve tried global bl and var bl, but all stays the same. Thank you for your help.
Try this :