Skip to content

Instantly share code, notes, and snippets.

@carmoreira
carmoreira / show.js
Last active May 15, 2022 16:32
Show all marker series in map, if drilldown is enabled - Interactive Geo Maps
// added this control check, in case code was added more than once
if (typeof mapCode === 'undefined') {
let mapID = 159; // CHANGE MAP ID HERE
let mapContainer = document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready', function(ev) {
iMaps.maps[mapID].series.forEach(function(serie) {
if (serie.className === 'MapImageSeries') {
serie.show();
}
});
@carmoreira
carmoreira / reset.js
Last active May 16, 2022 13:51
Interactive Geo Maps - Add reset link to content that display below/side
jQuery('.igm-map-content').each(function() {
var button = jQuery('<a>Close</a>');
button.on('click', function() {
var mapID = 3492169; // replace with your map ID
iMapsManager.clearSelected(mapID);
iMapsActions.resetActions(mapID);
});
jQuery(this).prepend(button);
});
@carmoreira
carmoreira / style.css
Created April 8, 2022 12:42
Interactive Geo Maps - Make tooltip smaller on mobile
@media only screen and (max-width:780px) {
.map_wrapper .imapsLabel foreignObject {
font-size:0.6em;
line-height:1.1em;
white-space:normal;
}
}
@carmoreira
carmoreira / france2015.geojson
Created April 1, 2022 08:52
France 2015 regions geojson file - compatible with Interactive Geo Maps WordPress plugin
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carmoreira
carmoreira / scroll.css
Created March 28, 2022 18:55
Scroll in tooltip overflow - Interactive Geo Maps
.imapsTooltip foreignObject > div {
max-height:100px !important;
overflow:scroll !important;
}
@carmoreira
carmoreira / zoomLevel.js
Last active March 30, 2022 14:07
Hide marker auto labels until specific zoom level is reached - Interactive Geo Maps
let mapID = 3491853; // replace with your map ID
let zoomLevel = 8; // replace with the zoom level you want to show the labels at
let igmNow = Date.now();
function igmHideMarkers(igmap) {
igmNow = Date.now();
let series = iMaps.maps[mapID].series;
series.forEach(function(serie) {
if (typeof serie.mapImages === 'undefined') {
return;
@carmoreira
carmoreira / dropshadow.js
Created March 24, 2022 10:23
Adding drop shadow to grouped entries in Interactive Geo Maps
let mapID = 21169; // change with your map ID
let mapContainer = document.getElementById('map_' + mapID);
if(mapContainer){
mapContainer.addEventListener('mapready',function(ev){
iMaps.maps[mapID].series.forEach(function(serie){
var filter = serie.filters.push(new am4core.DropShadowFilter());
filter.color = am4core.color("#000000");
filter.dx = 5;
filter.dy = 5;
filter.blur = 2;
@carmoreira
carmoreira / click.js
Created March 13, 2022 14:00
Interactive Geo Maps - Listen to zoom home button click event
let mapID = '3491792'; //replace with your map ID
iMaps.maps[mapID].map.zoomControl.children._values[0].events.on('hit', function() {
//run your custom code here, it will be triggered when the home button is clicked.
});
@carmoreira
carmoreira / usaCanada.geojson
Created March 1, 2022 23:19
USA and Canada divided by states/regions geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carmoreira
carmoreira / style.css
Created February 23, 2022 18:35
Reverse order of content in Interactive Geo Maps - Display Content on the right
.map_wrapper {
flex-direction: row-reverse;
}