click events
by QuadTriangle
HTML
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css">
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<div id="map"></div>
CSS
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
width: 100%;
}
JavaScript
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var circle = L.circle([51.508, -0.11], 500, {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5
}).addTo(map);
// Uncomment and watch circle steal the events
circle.on('mouseover', function(e) {
console.log('circle ' + e.latlng);
});
map.on('mouseover', function (e) {
console.log('map ' + e.latlng);
});