UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

68 lines (54 loc) 1.88 kB
<!DOCTYPE html> <html> <head> <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> <meta charset="utf-8"> <title>Leaflet JS Bin</title> <style> #map { width:600px; height:400px; } </style> </head> <body> <div id='map'></div> <script> // 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}); 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); //Draw the circles from left to right var myCoords1 = new L.LatLng(50.5, 30.50); var marker1 = L.circleMarker(myCoords1,{radius:30}).addTo(map); marker1.on('mouseover',function(e){ console.log("over 1") }); marker1.on('mouseout',function(e){ console.log("out 1") }); var myCoords2 = new L.LatLng(50.5, 30.5015); var marker2 = L.circleMarker(myCoords2,{radius:30}).addTo(map); marker2.on('mouseover',function(e){ console.log("over 2") }); marker2.on('mouseout',function(e){ console.log("out 2") }); var myCoords3 = new L.LatLng(50.5, 30.503); var marker3 = L.circleMarker(myCoords3,{radius:30}).addTo(map); marker3.on('mouseover',function(e){ console.log("over 3") }); marker3.on('mouseout',function(e){ console.log("out 3") }); </script> </body> </html>