Created
January 26, 2018 03:42
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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()); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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