Skip to content

Instantly share code, notes, and snippets.

@Fitoussi
Last active April 17, 2016 00:13
Show Gist options
  • Save Fitoussi/2792102b425a30d8bd48498a578f2250 to your computer and use it in GitHub Desktop.
Save Fitoussi/2792102b425a30d8bd48498a578f2250 to your computer and use it in GitHub Desktop.
Set custom map level when map updates
function gfgeo_set_custom_zoom_level() {
?>
jQuery( document ).ready( function() {
jQuery( document ).bind( 'gfgeo_update_map', function( event, mapObject ) {
// set map zoom level to 10
mapObject.map.setZoom( 10 );
// pan map into new position
mapObject.map.panTo( mapObject.latLng );
});
});
</script>
<?php
}
add_action( 'wp_footer', 'gfgeo_set_custom_zoom_level' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment