javascript jquery
I've got an iframe. I'm tracking if it's been clicked in using the blur method
var overiFrame = -1; $('iframe').hover( function() { overiFrame = $(this).closest('.banner').attr('bannerid'); }, function() { overiFrame = -1 }); $(window).blur( function() { if( overiFrame != -1 ){ seconds = 0; } });
This tracks the click, because now the window has been blurred.
The problem is, additional clicks aren't tracked and therefore resetting the seconds to 0.
Maybe I can refocus after it is set to 0, so that it can be blurred again.
If I switch out the seconds = 0, for an alert, the alert never stops firing (which is good) because the alert refocuses the window outside of the iframe and it is no longer blurred.
I've tried $("window").focus(), but that doesn't work.
What other options do I have?
Cheers,