Last active
September 23, 2016 21:46
-
-
Save chancesmith/efc8744cdf01a9a50fd481c21d01e14f to your computer and use it in GitHub Desktop.
Disable Google-Map/iFrame scroll until clicked. We first wrap all iframes with .overlay div, to disable the iframe. Then the user clicks to use. Then adds the overlay back when mouseleave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// // wrap all iFrames, except those with an id of #noOverlay | |
$('iframe').not( document.getElementById( "noOverlay" ) ).wrap('<div class="overlayiFrame" />'); | |
//overlay on iframes | |
$('.overlayiFrame iframe').css("pointer-events","none"); | |
$('.overlayiFrame').click(function () { | |
$('.overlayiFrame iframe').css("pointer-events", "auto"); | |
}); | |
$('.overlayiFrame').mouseleave(function () { | |
$('.overlayiFrame iframe').css("pointer-events", "none"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment