2015-05-08 22:32:57 +08:00
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Leaflet debug page</title>
|
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
|
|
|
<script src="../leaflet-include.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
This page tests if the cursors for dragging the map and the markers behave as expected. The left marker is draggable, the right one is not.
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
<div>Map dragging enabled:</div>
|
|
|
|
<div id="map1" style="height: 300px;width: 400px; float:left;"></div>
|
|
|
|
|
|
|
|
<div style="clear:both"></div>
|
|
|
|
|
|
|
|
<div>Map dragging disabled:</div>
|
|
|
|
<div id="map2" style="height: 300px;width: 400px; float:left;"></div>
|
|
|
|
|
2017-02-04 23:17:51 +08:00
|
|
|
<script>
|
2015-05-08 22:32:57 +08:00
|
|
|
function addLayerAndMarkers(map) {
|
|
|
|
var layer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
|
|
|
|
maxZoom : 18
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
var draggableMarker = L.marker([20, -120.3], {draggable: true} ).addTo(map);
|
|
|
|
var fixedMarker = L.marker([50.5, 30.5], {draggable: false}).addTo(map);
|
|
|
|
}
|
|
|
|
|
|
|
|
var map1 = new L.Map('map1', {
|
|
|
|
center : new L.LatLng(0, -30),
|
|
|
|
zoom : 0,
|
|
|
|
dragging : true,
|
|
|
|
});
|
|
|
|
|
|
|
|
var map2 = new L.Map('map2', {
|
|
|
|
center : new L.LatLng(0, -30),
|
|
|
|
zoom : 0,
|
|
|
|
dragging : false,
|
|
|
|
});
|
|
|
|
|
|
|
|
addLayerAndMarkers(map1);
|
|
|
|
addLayerAndMarkers(map2);
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|