WordPress.org

Support

Support » Plugins and Hacks » Events Manager » [Resolved] How can we control the zoom on Google Maps

[Resolved] How can we control the zoom on Google Maps

  • 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)
  • Philip John

    @philipjohn

    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

    cjc1867

    @cjc1867

    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

    caimin_nwl

    @caimin_nwl

    NetWebLogic Support

    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?

    cjc1867

    @cjc1867

    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

    caimin_nwl

    @caimin_nwl

    NetWebLogic Support

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

    cjc1867

    @cjc1867

    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

    cjc1867

    @cjc1867

    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 ‘[Resolved] How can we control the zoom on Google Maps’ is closed to new replies.
Skip to toolbar