Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlos Moreira carmoreira

View GitHub Profile
@carmoreira
carmoreira / click.js
Created Mar 13, 2022
Interactive Geo Maps - Listen to zoom home button click event
View click.js
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 Mar 1, 2022
USA and Canada divided by states/regions geojson
View usaCanada.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 Feb 23, 2022
Reverse order of content in Interactive Geo Maps - Display Content on the right
View style.css
.map_wrapper {
flex-direction: row-reverse;
}
@carmoreira
carmoreira / step.js
Last active Feb 15, 2022
Increase default zoom step on maps for Interactive Geo Maps
View step.js
// 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 Feb 11, 2022
Interactive Geo Maps - Map jumps when click action is triggered - Elementor issue - CSS Fix
View fix.css
@media (min-width:1025px) {
#elementor-device-mode:after {
content: "" !important;
}}
@carmoreira
carmoreira / filter.php
Last active Feb 9, 2022
Add Lines and markers to the map on the fly with PHP - Interactive Geo Maps
View filter.php
<?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 Feb 8, 2022
Select marker by default on map load - Interactive Geo Maps
View load.js
// 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 Feb 3, 2022
Reset map on load to fix zoom/center issues
View gohome.js
// 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 Sep 7, 2022
Interactive Geo Maps - Reset map to home position (goHome) when closing lightbox
View lightbox.js
// 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 Jan 25, 2022
Remove or change round marker border/stroke - Interactive Geo Maps
View styles.css
/* Remove markers border */
.imapsCircle {
stroke-width:0 !important;
}
/* Change border colour */
.imapsCircle {
stroke:#6699CC !important;;
}