Skip to content

Instantly share code, notes, and snippets.

@carmoreira
Last active September 28, 2021 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carmoreira/e608cc2bedcf842114d9ced56a5d6e27 to your computer and use it in GitHub Desktop.
Save carmoreira/e608cc2bedcf842114d9ced56a5d6e27 to your computer and use it in GitHub Desktop.
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