Skip to content

Instantly share code, notes, and snippets.

@chancesmith
Last active September 23, 2016 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chancesmith/efc8744cdf01a9a50fd481c21d01e14f to your computer and use it in GitHub Desktop.
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
// // 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