O'Reilly logo

OpenLayers 2.10 by Erik Hazzard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Events

An event basically means what it sounds like—something happening. Really, all user input is an event—a key press, a mouse click, etc. are all events.

Using JavaScript, we're able to access user generated events, such as a mouse click, and do things when an event occurs. Events are what drive the interaction in OpenLayers—when you drag the map, you are actually issuing a mouse event that OpenLayers interprets and then updates the map accordingly.

OpenLayers has its own Event class which makes interacting with events easier, and even enables us to create our own custom events. We won't get much into that right now, but we should briefly talk about something known as event handlers.

Event listeners and handlers

If you understood the previous paragraphs, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required