Created
November 14, 2012 08:10
-
-
Save robpvn/4070934 to your computer and use it in GitHub Desktop.
Mouse event tester in leaflet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Mouseevent test map</title> | |
<meta charset="utf-8" /> | |
<!-- Leaflet --> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.css" /> | |
<!--[if lte IE 8]><link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.ie.css" /><![endif]--> | |
<script src="http://cdn.leafletjs.com/leaflet-0.4/leaflet.js" type="text/javascript"></script> | |
<!-- Leaflet Plugins --> | |
</head> | |
<body> | |
<h1>Mouseevent test map</h1> | |
<div id="map" style="width:500px;height:500px;"></div> | |
<script type="text/javascript"> | |
//All you need to set up a simple map with the test user | |
var map = new L.Map('map'); | |
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; | |
var osmAttrib='Map data © OpenStreetMap contributors'; | |
var osm = new L.TileLayer(osmUrl, {minZoom: 8, maxZoom: 16, attribution: osmAttrib}); | |
map.addLayer(osm); | |
map.setView(new L.LatLng(59.92448055859924, 10.758276373601069),10); | |
//Documented, but doesn't work | |
map.on('mouseenter', console.log("mouse entered map")); | |
//Undocumented, works | |
map.on('mouseover', console.log("mouse over map")); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment