[Resolved] Google Maps: toggle disable scroll zoom/enable pointer events

Home Forums Support [Resolved] Google Maps: toggle disable scroll zoom/enable pointer events

Home Forums Support Google Maps: toggle disable scroll zoom/enable pointer events

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #359066
    J

    Hi there, I have a problem integrating a Google Maps iframe. By using style="pointer-events:none" in the iframe the annoying zoom effect is gone when the user scrolls the page. By adding the toggle (see code below, found elsewhere) the map should be accessible when the user clicks the map. I added the function to wp_footer (using GP Hooks). Doesn’t seem to work. Also tried to embed the script directly in the page. No luck either. What am I doing wrong?

    $function() {
      $('#gmap-holder').click(function(e) {
        $(this).find('iframe').css('pointer-events','all');
      }).mouseleave(function(e) {
        $(this).find('iframe').css('pointer-events','none');
      });
    })

    Edit: title, added ‘zoom’.

    #359211
    Tom
    Lead Developer
    Lead Developer

    Try adding this into wp_footer:

    <script>
    jQuery(function($) {
      $('#gmap-holder').click(function(e) {
        $(this).find('iframe').css('pointer-events','all');
      }).mouseleave(function(e) {
        $(this).find('iframe').css('pointer-events','none');
      });
    });
    </script>
    #359289
    J

    Works!

    Thanks

    #359552
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.