Chapter 5. Understanding Google Maps JavaScript API Events

In this chapter, we will cover:

  • Creating two synced maps side by side
  • Getting the coordinates of a mouse click
  • Creating a context menu on a map
  • Restricting the map extent
  • Creating a control that shows coordinates
  • Creating your own events

Introduction

If you have ever worked on JavaScript programming, you should know the importance of events. Events are the core of JavaScript. There are events behind interactions in web pages. There can be user interactions or browser actions that can be handled with the help of events.

For example, in every code from the beginning of this book, we have wrote something like the following line of code:

google.maps.event.addDomListener(window, 'load', initMap);

This ...

Get Google Maps JavaScript API Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.