Last active
November 27, 2020 07:26
-
-
Save adrianosferreira/1468dc174a1d0052bf32 to your computer and use it in GitHub Desktop.
Change the zoom if a particular marker is present
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
/* | |
* This snippet will change the map zoom if a particular marker is present. | |
* Used here: https://wp-types.com/forums/topic/change-what-a-map-shows-when-there-are-no-search-results/#post-374619 | |
*/ | |
jQuery( document ).on( 'js_event_wpv_addon_maps_init_map_started', function( event, data ) { | |
if (WPViews.view_addon_maps.maps_data[0].markers[0].marker == 'marker-123'){ | |
data.map_options.single_zoom = 1; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment