Last active
August 29, 2015 14:23
-
-
Save joshuahouston/800cd59aab26c264f3bc to your computer and use it in GitHub Desktop.
Random Text Test
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='script.js'></script> | |
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> | |
<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.map('map').setView([47.16, -115.316], 14); | |
// add an OpenStreetMap tile layer | |
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { | |
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | |
}).addTo(map); | |
var marker = L.marker([47.16, -115.32]).on('click', bindNewPopup) | |
.addTo(map); | |
</script> | |
</body> | |
</html> |
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
function randomText() { | |
var items = new Array( | |
"Ow", | |
"Stop poking me", | |
"Stop", | |
"Leave me alone", | |
"Don't you have anything better to do?", | |
"You're hurting me", | |
"Go away" | |
); | |
// Generates a random integer within the array index | |
var i = Math.floor(Math.random() * items.length); | |
return items[i];} | |
function bindNewPopup(){ | |
this.bindPopup(randomText()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment