Created
February 21, 2023 05:34
-
-
Save DylanCodeCabin/07d27be0f719526d78ed9f0206aa0bcf to your computer and use it in GitHub Desktop.
This file contains 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
jQuery(function($){ | |
$(document.body).on('markersplaced.wpgmza', () => { | |
const titleQuery = WPGMZA.getQueryParamValue('qtitle'); | |
const zoomQuery = WPGMZA.getQueryParamValue('qzoom'); | |
if(titleQuery){ | |
const map = WPGMZA.maps[0]; | |
const markers = map.markers; | |
let matchFound = false; | |
for(let marker of markers){ | |
if(matchFound){ continue; } | |
if(marker.title.toLowerCase().trim() === titleQuery.toLowerCase().trim()){ | |
map.setZoom(zoomQuery ? parseInt(zoomQuery) : 16); | |
marker.trigger('select'); | |
map.setCenter(marker.getPosition()); | |
} | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment