Created
January 22, 2013 22:11
-
-
Save tmcw/4599032 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.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%; } | |
</style> | |
</head> | |
<body> | |
<style> | |
#map-ui { | |
position:absolute; | |
top:10px;left:10px; | |
list-style:none; | |
margin:0;padding:0; | |
z-index:100; | |
} | |
#map-ui a { | |
font:bold 15px/18px 'Helvetica Neue',Helvetica,sans-serif; | |
background: #FFF; | |
color:#3C4E5A; | |
display:block; | |
margin:0;padding:0; | |
border:1px solid #BBB; | |
border-bottom-width:0; | |
min-width:138px; | |
padding:10px; | |
text-decoration:none; | |
} | |
#map-ui a:hover { background:#FFF; } | |
#map-ui li:last-child a { | |
border-bottom-width:1px; | |
-webkit-border-radius:0 0 3px 3px; | |
border-radius:0 0 3px 3px; | |
} | |
#map-ui li:first-child a { | |
-webkit-border-radius:3px 3px 0 0; | |
border-radius:3px 3px 0 0; | |
} | |
#map-ui a.active { | |
background:#000; | |
border-color:#666; | |
border-top-color: #FFF; | |
color: #FFF; | |
} | |
</style> | |
<ul id='map-ui'></ul> | |
<div id='map'></div> | |
<script> | |
mapbox.load(['hot.Jakarta_Floods', 'hot.Hospital'], function(o) { | |
var map = mapbox.map('map'); | |
var layers = document.getElementById('map-ui'); | |
var infolayer = o[0].layer.named('Flooded Areas'); | |
map.addLayer(infolayer); | |
var infolayer = o[1].layer.named('Evacuation Centers'); | |
map.addLayer(infolayer); | |
map.zoom(12); | |
map.interaction.auto(); | |
// Create a simple layer switcher that toggles layers on | |
// and off. | |
for (var i = 0; i < map.getLayers().length; i++) { | |
var n = map.getLayerAt(i).name; | |
var item = document.createElement('li'); | |
var layer = document.createElement('a'); | |
layer.href = '#'; | |
layer.id = n; | |
layer.className = 'active'; | |
layer.innerHTML = 'Layer ' + n; | |
layer.onclick = function(e) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
map.getLayer(this.id).enabled ? map.getLayer(this.id).disable() : map.getLayer(this.id).enable(); | |
this.className = map.getLayer(this.id).enabled ? 'active' : ''; | |
map.interaction.refresh() | |
}; | |
item.appendChild(layer); | |
layers.appendChild(item); | |
} | |
map.interaction.auto(); | |
map.center({ lat: -6.1807, lon: 106.8343 }); | |
// Attribute map | |
map.ui.attribution.add() | |
.content('<a href="http://mapbox.com/about/maps">Terms & Feedback</a> \251 OpenStreetMap Contributors'); | |
}); | |
</script> | |
<div style="position: absolute; right: 0; bottom: 0;z-index:0;"> | |
<img src="Logo_set.png" style="float:right;width:200px;"/> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment