Created
June 17, 2020 11:26
-
-
Save PerryRylance/462cafd319e2059da51b79b69f6b6a6c to your computer and use it in GitHub Desktop.
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
jQuery(function($){ | |
$(document.body).on("init.wpgmza", function(event) { | |
var map = event.map; | |
var button = $("<button type='button'>Toggle KML</button>"); | |
button.on("click", function(event) { | |
map.kmlLayers.forEach(function(layer) { | |
if(layer.getMap()) | |
layer.setMap(null); | |
else | |
layer.setMap(map.googleMap); | |
}); | |
}); | |
$(map.element).before(button); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment