Skip to content

Instantly share code, notes, and snippets.

@javisantana
Last active December 13, 2015 16:49
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 javisantana/4942923 to your computer and use it in GitHub Desktop.
Save javisantana/4942923 to your computer and use it in GitHub Desktop.
<html>
<head>
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script>
</head>
<body>
<div id="map"></div>
</body>
<script>
var map = L.map('map', {
zoomControl: false,
center: [43, 0],
zoom: 3
})
L.tileLayer('http://tile.stamen.com/toner/{z}/{x}/{y}.png', {
attribution: 'stamen'
}).addTo(map);
var layer = L.tileLayer('http://3.tiles.cartocdn.com/examples/tiles/ne_10m_populated_p_2/{z}/{x}/{y}.png', {
attribution: 'cartodb'
}).addTo(map);
var showing = true;
setInterval(function() {
layer.setOpacity(showing ? 0.2 : 0.9);
showing = !showing;
}, 2000);
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment