UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

45 lines (33 loc) 1.49 kB
<!DOCTYPE html> <html> <head> <title>Leaflet debug page</title> <link rel="stylesheet" href="../../dist/leaflet.css" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="../css/screen.css" /> <script type="text/javascript" src="../../build/deps.js"></script> <script src="../leaflet-include.js"></script> </head> <body> <div id="map"></div> <button id="populate">Populate with 10 markers</button> <script type="text/javascript"> // Remember to include either the Leaflet 0.7.3 or the Leaflet 1.0.0-beta1 library var myCenter = new L.LatLng(50.5, 30.51); var map = new L.Map('map', {center: myCenter, zoom: 15, preferCanvas: true}); var positron = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>' }).addTo(map); var standardStyle = { weight: 1, fill: false}; var hoverStyle = {fillOpacity: 1, fill: true, weight: 20}; var polygon = L.polygon([[50.5, 30.51], [50.51, 30.52], [50.51, 30.50]], standardStyle) .on('mouseover', function() { polygon.setStyle(hoverStyle); }) .on('mouseout', function() { polygon.setStyle(standardStyle); }) .addTo(map); </script> </body> </html>