[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
    Wieswies

    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’.

    GeneratePress 1.3.48
    GP Premium 1.3.1
    #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
    Wieswies

    Works!

    Thanks

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