Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Forked from tmcw/index.html
Created December 18, 2012 21:03
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 wboykinm/4331984 to your computer and use it in GitHub Desktop.
Save wboykinm/4331984 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js'></script>
<script src='http://code.jquery.com/jquery-1.8.3.min.js'></script>
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
#switch { position:absolute; top:0; bottom:0; left: 300px width:300px; }
</style>
</head>
<body>
<div id='map'></div>
<div id='switch'>
<button data-layer='landplanner.map-a0wbwf43'>a</button>
<button data-layer='landplanner.blackmarble2'>b</button>
<button data-layer='landplanner.enstrat_dni_101111b'>c</button>
</div>
<script>
var map = mapbox.map('map').zoom(3);;
map.addLayer(mapbox.layer().id('examples.map-vyofok3q'));
$('button').click(function() {
map.getLayerAt(0).id($(this).data('layer'));
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment