简体   繁体   中英

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?

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();
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM