2012-08-02 07:30:50 +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/mobile.css" />
|
|
|
|
<style>
|
|
|
|
.mybox {
|
|
|
|
background-color: red;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
2013-01-31 18:29:39 +08:00
|
|
|
<script type="text/javascript" src="../../build/deps.js"></script>
|
2012-08-02 07:30:50 +08:00
|
|
|
<script src="../leaflet-include.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="map"></div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
2014-03-04 23:54:41 +08:00
|
|
|
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
|
|
osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
|
|
|
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
|
2012-08-02 07:30:50 +08:00
|
|
|
latlng = new L.LatLng(50.5, 30.51);
|
|
|
|
|
2014-03-04 23:54:41 +08:00
|
|
|
var map = new L.Map('map', {center: latlng, zoom: 15, layers: [osm]});
|
2012-08-02 07:30:50 +08:00
|
|
|
|
|
|
|
//Create a marker, clicking it toggles opacity
|
|
|
|
var marker = new L.Marker(latlng, { icon: new L.DivIcon({ className: 'mybox', iconSize: new L.Point(100,100), html: 'opaque. click to toggle' }) });
|
|
|
|
map.addLayer(marker);
|
|
|
|
|
|
|
|
var visible = true;
|
|
|
|
marker.on('click', function () {
|
|
|
|
if (visible) {
|
|
|
|
marker.setOpacity(0.3);
|
|
|
|
marker._icon.innerHTML = 'transparent';
|
|
|
|
} else {
|
|
|
|
marker.setOpacity(1);
|
|
|
|
marker._icon.innerHTML = 'opaque';
|
|
|
|
}
|
|
|
|
visible = !visible;
|
|
|
|
});
|
|
|
|
|
|
|
|
var marker2 = new L.Marker(new L.LatLng(50.5, 30.52));
|
|
|
|
map.addLayer(marker2);
|
|
|
|
marker2.bindPopup('This is an amazing message. I shouldn\'t of deleted the Ipsum text');
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|