Last active
September 28, 2021 09:26
-
-
Save carmoreira/e608cc2bedcf842114d9ced56a5d6e27 to your computer and use it in GitHub Desktop.
select region by default, when map loads - interactive geo maps
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
// 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