O'Reilly logo

jQuery UI Cookbook by Adam Boduch

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

Displaying the mouse movement

We can use the tooltip widget as an aid during development, and not necessarily a widget that ships with the finished product. For example, we can use the tooltip widget to track the mouse movements and to display the X and Y coordinates. This could help us diagnose some tricky mouse behavior as we're piecing together the UI components. We'll look at tracking the mouse coordinates for specific elements, but bear in mind, the concept is what counts. We can use this technique to display any number of event properties—we simply discard the call when no longer needed.

How to do it...

We'll create the required CSS first. These simply position the div elements that we'll want to track mouse movements on.

.mouse-tracker { margin: ...

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