Skip to content

Instantly share code, notes, and snippets.

@danbru1989
Created January 26, 2018 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danbru1989/a1f1516ffe12f51b2517a897fae044ca to your computer and use it in GitHub Desktop.
Save danbru1989/a1f1516ffe12f51b2517a897fae044ca to your computer and use it in GitHub Desktop.
Scripts to change the Events Manager map zoom level, close the info window, and center on the marker.
/**
* @description This script modifies the Events Manager map
*
* @author Dan Brubaker
*
*/
// Modify Event Manager Map
jQuery(document).ready(function ($) {
jQuery(document).bind('em_maps_location_hook', function (e, map, infowindow, marker) {
// Set Zoom Level to 4
map.setZoom(4);
// Close the Info Window
setTimeout(function(){ infowindow.close(); }, 500);
// Center map on the marker
map.panTo(marker.getPosition());
});
});
// Add modifications to the Events Manager map
wp_enqueue_script( 'events-manager-map', get_stylesheet_directory_uri() . '/js/events-manager-map.js', array( 'jquery' ), CHILD_THEME_VERSION, true );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment