Skip to content

Commit db7aaf7

Browse files
author
Nathan
committed
add readonly toggle button in example
1 parent 87d970e commit db7aaf7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

examples/index.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
1010
<![endif]-->
1111
<style>
12-
body { margin:0; padding:0; }
12+
body { margin:0; padding:0; font-family: arial; }
1313
#map { position:absolute; top:0; bottom:0; width:100%; }
14+
#toggle-readonly { position:absolute; bottom: 0; left: 0; background-color: red; color: #000; padding: 20px; font-size: 2em; cursor: pointer; }
1415
</style>
1516
</head>
1617
<body>
1718
<div id="map"></div>
19+
<div id="toggle-readonly">Toggle Readonly</div>
1820
<script type="text/javascript">
1921

2022
var map = L.map('map').setView([51.505, -0.09], 13);
@@ -36,6 +38,14 @@
3638
],{
3739
weight: 5
3840
}).addTo(map);
41+
42+
// Trigger for toggling readonly property
43+
var readOnly = false;
44+
document.getElementById('toggle-readonly').onclick = function(){
45+
readOnly = !readOnly;
46+
plottedPolyline.setReadOnly(readOnly);
47+
}
48+
3949
</script>
4050
</body>
4151
</html>

0 commit comments

Comments
 (0)