Created
September 7, 2012 12:12
-
-
Save perliedman/3665685 to your computer and use it in GitHub Desktop.
Markers with Leaflet.iconlabel plugin (https://github.com/jacobtoye/Leaflet.iconlabel), which at least for me appear with an increasing offset. I believe this is a bug.
This file contains hidden or 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 lang="en"> | |
<head> | |
<title>Gypsum</title> | |
<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.css"/> | |
<link rel="stylesheet" type="text/css" href='https://raw.github.com/jacobtoye/Leaflet.iconlabel/master/dist/leaflet.iconlabel.css'/> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<script src='http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.js'></script> | |
<script src='https://raw.github.com/jacobtoye/Leaflet.iconlabel/master/dist/leaflet.iconlabel.js'></script> | |
</head> | |
<body style="margin:0; padding: 0;"> | |
<div id="map" style="position:absolute; width:100%; height:100%;"></div> | |
<script> | |
var map = new L.Map('map'); | |
L.tileLayer('http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png', { | |
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>' | |
}).addTo(map); | |
var markers = new L.FeatureGroup(); | |
for (var i = 0; i < 10; i++) { | |
var marker = new L.Marker(new L.LatLng(57.73, 11.947), { | |
title: i, | |
icon: new L.Icon.Label.Default({ | |
labelText: i | |
}) | |
}) | |
markers.addLayer(marker); | |
} | |
map.addLayer(markers); | |
map.setView([57.73, 11.947],13); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment