Skip to content

Instantly share code, notes, and snippets.

@carmoreira
carmoreira / step.js
Last active February 15, 2022 21:28
Increase default zoom step on maps for Interactive Geo Maps
// replace with your map ID
let mapID = 21148;
let mapContainer = document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready',function(ev){
iMaps.maps[mapID].map.zoomStep = 3;
});
@carmoreira
carmoreira / fix.css
Created February 11, 2022 11:13
Interactive Geo Maps - Map jumps when click action is triggered - Elementor issue - CSS Fix
@media (min-width:1025px) {
#elementor-device-mode:after {
content: "" !important;
}}
@carmoreira
carmoreira / filter.php
Last active February 9, 2022 12:17
Add Lines and markers to the map on the fly with PHP - Interactive Geo Maps
<?php
add_filter( 'igm_add_meta', 'igm_lines_on_the_fly', 1 );
function igm_lines_on_the_fly( $meta ){
// point 1
$lat01 = floatval( '-7.508726' );
$lon01 = floatval( '-36.119106' );
// point 2
@carmoreira
carmoreira / load.js
Created February 8, 2022 15:51
Select marker by default on map load - Interactive Geo Maps
// replace with your map ID and marker title.
let mapUID = 3491660;
let markerTitle = 'My Marker Title';
let mapContainer = document.getElementById('map_' + mapUID);
mapContainer.addEventListener('mapready', function(ev) {
setTimeout(function(){ iMapsManager.select(mapUID, markerTitle) },500);
});
@carmoreira
carmoreira / gohome.js
Created February 3, 2022 09:35
Reset map on load to fix zoom/center issues
// replace with your map ID
let mapID = 237;
let mapContainer = document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready', function(ev) {
iMaps.maps[mapID].map.goHome();
});
@carmoreira
carmoreira / lightbox.js
Last active September 7, 2022 13:31
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();
@carmoreira
carmoreira / styles.css
Created January 25, 2022 10:38
Remove or change round marker border/stroke - Interactive Geo Maps
/* Remove markers border */
.imapsCircle {
stroke-width:0 !important;
}
/* Change border colour */
.imapsCircle {
stroke:#6699CC !important;;
}
@carmoreira
carmoreira / style.css
Created January 24, 2022 20:35
Pulsating hover effect on round marker - Interactive Geo Maps
.imapsCircle{
paint-order: stroke;
stroke-opacity:1;
transition: all 0.8s;
}
.imapsCircle:hover {
stroke-width:15px;
stroke-opacity:0;
}
@carmoreira
carmoreira / style.css
Created January 20, 2022 15:32
Force iframe in lightbox to be 16:9 - Interactive Geo Maps
.igm-map-content {
position: relative;
padding-bottom: 56.25% !important; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
height: 0;
overflow: hidden;
}
.igm-map-content iframe {
position: absolute;
top: 0;
@carmoreira
carmoreira / animation.css
Created January 20, 2022 12:30
Animate Dashed Lines - Infinite Loop - Interactive Geo Maps
.imapsMapLine-group path {
stroke-dasharray: 10;
stroke-dashoffset: 100;
animation: dash 5s linear infinite;
}
@keyframes dash {
from {
stroke-dashoffset: 100;
}