i have the following code for multiple flyers that when clicked will display a help text overlay that goes away after 4 seconds. I can get it to show the help text but the timeout doesnt work.
$(".flyercontainer").click(function(){
$(this).children('.flyerHelp').css('opacity',0.8);
setTimeout(function(){
$(this).children('.flyerHelp').css('opacity',0);
},4000);
})
thanks for your help.
The this in your setTimeOut()'s callback is not what you think it is (it points to the global object, window).
$(".flyercontainer").click(function(){
var children = $(this).children('.flyerHelp');
children.css('opacity',0.8);
setTimeout(function(){
children.css('opacity',0);
},4000);
});
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