leaflet-plugins
Version:
Miscellaneous plugins for Leaflet library for services that need to display route information and need satellite imagery from different providers
37 lines (32 loc) • 897 B
HTML
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet-src.js"></script>
<script src="../layer/Marker.Rotate.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script type='text/javascript'>
var map = new L.Map('map', {center: new L.LatLng(67.6755, 33.936), zoom: 10});
map.addLayer(new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'));
L.marker(map.getCenter()).addTo(map);
var marker = new L.Marker(map.getCenter(), {
iconAngle: 90,
icon: L.icon({
iconUrl: '../css/cross.png',
iconSize: [16,16],
iconAnchor: [8,8]
})
});
map.addLayer(marker);
var angle = 0;
function _rotate() {
marker.setIconAngle(angle);
angle = (angle + 10) % 360;
setTimeout(_rotate, 1000);
}
_rotate();
</script>
</body>
</html>