In-class Exercise: JavaScript
Part 1: Listening for Leaflet events
- Remix this Glitch project into your Glitch account.
- In the JavaScript, listen for more map events and log out the name of the event. For example, copy
paste those lines (so themap.on('moveend', function () { console.log('moveend'); });
moveend
listener still exists) and changemoveend
in the new listener, like this:
Don't forget to change what is logged out, too, so you can see which event happened.map.on('click', function () { console.log('click'); });
- Do the above process until you have three different map events. Pay special attention to:
click
dblclick
mousedown
mouseup
move