Skip to content

Instantly share code, notes, and snippets.

@carmoreira
Last active September 7, 2022 13:31
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/447245587a1bd458798350d976a7e73c to your computer and use it in GitHub Desktop.
Save carmoreira/447245587a1bd458798350d976a7e73c to your computer and use it in GitHub Desktop.
Interactive Geo Maps - Reset map to home position (goHome) when closing lightbox
// replace with your map ID
let mapID = 3491625;
let mapContainer = document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready', function(ev) {
iMaps.maps[mapID].series[0].mapPolygons.each(function(region) {
region.events.on("hit", function(ev) {
setTimeout(function(){
iMapsActions.lightbox.on('close', function(){
iMapsManager.clearSelected(mapID);
iMaps.maps[mapID].map.goHome();
});
},500);
}, this);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment