Created
September 14, 2012 17:45
-
-
Save willwhite/3723470 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.5/mapbox.js'></script> | |
<link href='http://api.tiles.mapbox.com/mapbox.js/v0.6.5/mapbox.css' rel='stylesheet' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
.counter { | |
z-index:999; | |
color:#fff; | |
position:absolute; | |
bottom:0; | |
left:50%; | |
font-size:52px; | |
text-align:center; | |
font-family:sans-serif; | |
background:black; | |
opacity:0; | |
padding:10px; | |
animation:cloud 1000ms linear; | |
-moz-animation:cloud 1000ms linear; | |
-webkit-animation:cloud 1000ms linear; | |
} | |
@keyframes { | |
0% { bottom:0px; } | |
50% { bottom:100px; opacity:1; } | |
100% { bottom:200px; } | |
} | |
@-moz-keyframes cloud { | |
0% { bottom:0px; } | |
50% { bottom:100px; opacity:1; } | |
100% { bottom:200px; } | |
} | |
@-webkit-keyframes cloud { | |
0% { bottom:0px; } | |
50% { bottom:100px; opacity:1; } | |
100% { bottom:200px; } | |
} | |
</style> | |
</head> | |
<body> | |
<div id='map'></div> | |
<script> | |
mapbox.load('examples.map-8ced9urs', function(o) { | |
var map = mapbox.map('map'); | |
map.addLayer(o.layer); | |
map.centerzoom(o.center, o.zoom); | |
var last; | |
wax.mm.interaction() | |
.map(map) | |
.tilejson(o) | |
.on({ | |
on: function(interaction) { | |
if (last == interaction.data.count) return; // Don't keep showing the same number over again. | |
last = interaction.data.count; | |
var map = document.getElementById('map'); | |
var div = document.createElement('div'); | |
div.appendChild(document.createTextNode(interaction.data.count)); | |
div.className = 'counter'; | |
map.appendChild(div); | |
setTimeout(function() { | |
map.removeChild(div); | |
}, 5000); | |
}, | |
off: function(interaction) { | |
console.log('off'); | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment