• Resolved semrocc

    (@semrocc)


    After updating to Version 5.9.3 it seems like the Google map zoom is not working. Here is an example of what I am using on a location page to show a map:

    
    <script>
    jQuery(document).bind('em_maps_locations_hook', function( e, map, infowindow, marker ) {
    	google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
    		if (this.getZoom()) {
    		this.setZoom(15);
    		}
    	});
    });
    </script>
    

    The Zoom works, but it seems to default to the lowest level and you need to zoom out to see properly.

    Any direction would be appreciated…thanks!

    • This topic was modified 6 years, 9 months ago by semrocc.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    let me try to test this on our test server and will update you here.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    you can try this custom snippet and working fine on our test site

    
    <?php
    function map_zoom() {
    ?>
      <script>
       jQuery(document).bind('em_maps_location_hook', function( e, map, infowindow, marker ) {
         google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
           if (this.getZoom()) {
             this.setZoom(18);
           }
         });
       });
      </script>
    <?php
    }
    add_action( 'wp_footer', 'map_zoom', 100 );
    ?>
    
    • This reply was modified 6 years, 9 months ago by angelo_nwl.
    Thread Starter semrocc

    (@semrocc)

    Thanks Angelo, I gave that a try and it still did not make any difference. The map displays, but after updating to 5.9.3 the zoom is no longer recognized on a location page.

    I am displaying the map on a single-location.php page if that helps, full code below:

    
    <script>
    jQuery(document).bind('em_maps_locations_hook', function( e, map, infowindow, marker ) {
    	google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
    		if (this.getZoom()) {
    		this.setZoom(15);
    		}
    	});
    });
    </script>
    <?php global $EM_Location; ?>
    <?php echo do_shortcode('[locations_map location="'.$EM_Location->location_id.'"]'); ?>
    
    Plugin Support angelo_nwl

    (@angelo_nwl)

    with the snippet I shared above Im using “em_maps_location_hook” instead of “em_maps_locations_hook”

    Thread Starter semrocc

    (@semrocc)

    Thanks for pointing that out Angelo. I have tried again with your snippet and by changing mine to “em_maps_location_hook” and still no change.

    Any other thoughts?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    hmm, the above shortcode I shared seems working fine on our test server when viewing on single events page.

    Thread Starter semrocc

    (@semrocc)

    Hi Angelo, I am displaying the map on a single-location.php page, maybe that’s where the problem is?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    hmm, i tried with single location page and seems to be working fine still on our test servers.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘setZoom Not Working Anymore’ is closed to new replies.