Support » Plugin: Events Manager » How can we control the zoom on Google Maps

  • Resolved cjc1867

    (@cjc1867)


    Hi
    I want to show a map on an events page for one location but the Google Map is zoomed in way too far. It would be nice if it zoomed out at least 5 or 6 times.

    It would also be nice if you could control the zoom anyway within the plugin by the use of the shortcode.

    Thanks

    http://wordpress.org/plugins/events-manager/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hiya,

    It’s possible to set the zoom, but will require a little coding. This should get you going: http://wp-events-plugin.com/tutorials/modifying-event-location-google-maps/

    Thanks,
    Phil

    Thanks for the link but I’m useless at javascript and jQuery.

    I have added this to header.php to see if I can get it to work:

    <script>
        jQuery( document ).ready(function( $ ) {
            jQuery(document).bind('em_maps_location_hook', function( e, map, infowindow, marker ){
    	    map.setZoom(10);
                map.setCenter(marker.getPosition());
            });
        });
    </script>

    Where have I gone wrong as it doesn’t work?

    Thanks

    Plugin Support caimin_nwl

    (@caimin_nwl)

    First thing is to make sure the function is actually firing when the page loads. Change the first two lines of code to this…

    <script>
        jQuery( document ).ready(function( $ ) {
    alert ("ok");

    …keeping the rest of the code the same.

    When you load the page, do you see an alert box with OK in it?

    Hi
    No it isn’t firing and no alert box with the code below….

    <script>
        jQuery(document).ready(function ($) {
            jQuery(document).bind('em_maps_location_hook', function (e, map, infowindow, marker) {
                alert("OK");
                map.setZoom(10);
            });
        });
    </script>

    thanks

    Plugin Support caimin_nwl

    (@caimin_nwl)

    What about if you put the alert code as the first line of the function, right before the bind function?

    Hi
    If I add the alert before then yes it shows but it is not doing the bind function.

    I have had some success, I have added the code below to one of my themes js files.

    jQuery(document).bind('em_maps_location_hook', function (e, map, infowindow, marker) {
                map.setZoom(16);
      });

    This controls the shortcode [location post_id=”58″] but not [locations_map country=”UK”] so how do we control this one? Is there another hook?

    Thanks

    Hi
    I’m on a roll now and found the other hook:

    jQuery(document).bind('em_maps_locations_hook', function (e, map, infowindow, marker) {
                map.setZoom(16);
      });

    I can now control the zoom even if the plugin is updated.

    Yipppeeeee

    I know this is resolved but hoping cjc1867 is still receiving follow up emails.

    I added the code above to one of the js files in my customizr folder…still not getting anything. I have no clue what I’m doing…hoping somebody can put this in layman terms for me

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How can we control the zoom on Google Maps’ is closed to new replies.