snuuve
snuuve

Reputation: 315

Window.onblur - disable iframe event

I need to use some scripts after window.onblur event. But on my app i have Google Maps, which one is injected into iframe. Evervy click on iframe firing window.onblur(). How to prevent this?

Upvotes: 1

Views: 1152

Answers (1)

user6319890
user6319890

Reputation:

You can prevent the default window.blur event if the original target of the event is the iframe.

$(window).blur(function(event){
    if($(event.target).attr('id')== "myiframe"){
        event.preventDefault();
    }
});

Upvotes: 1

Related Questions