Events and Objects

We can't look at dragging layers without including events and objects. You may already understand these concepts (from Chapter 10), but I'll include a brief review just in case.

Events

Events are things that happen that the browser can detect. For example, the page loading, the user pressing a mouse button, moving the mouse, and releasing a button are all events. Fortunately, the browser doesn't just notice that these events occur—the browser also sees exactly where the events occurred. For example, if the user clicks somewhere on a screen, JavaScript is not only aware that the click occurred, but also knows where on the screen it happened.

We'll be looking at only three events in this chapter:

  • mousedown: The user presses ...

Get Advanced JavaScript™: Insights and Innovative Techniques 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.