Skip to content

Instantly share code, notes, and snippets.

@ajashton
Last active December 16, 2015 23:30
Show Gist options
  • Save ajashton/5514646 to your computer and use it in GitHub Desktop.
Save ajashton/5514646 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.css' rel='stylesheet' />
<!--[if lte IE 8]>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.ie.css' rel='stylesheet' >
<![endif]-->
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
var map = L.mapbox.map('map', 'examples.map-zr0njcqy');
// Open popup when user mouses over a marker
map.markerLayer.on('ready', function(e) {
var places = [
[40.72,-73.97], // New York
[48.85,2.35] // Paris
];
cycle(places);
});
function cycle(places) {
var i = -1;
function run() {
if (++i > places.length - 1) i = 0;
map.setView(places[i], 14);
window.setTimeout(run, 5000);
}
run();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment