Skip to content

Instantly share code, notes, and snippets.

@carmoreira
Last active September 28, 2021 09:26
Embed
What would you like to do?
select region by default, when map loads - interactive geo maps
// replace with your map ID and region code.
let mapUID = 236195;
let regionCode = 'US-CA';
let mapContainer = document.getElementById('map_' + mapUID);
mapContainer.addEventListener('mapready', function(ev) {
let urlParams = new URLSearchParams(window.location.search);
let myParam = urlParams.get('mregion');
if(!myParam){
setTimeout(function(){ iMapsManager.select(mapUID, regionCode) },500);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment