O'Reilly logo

MooTools 1.3 Cookbook by Jay Larry G. Johnston

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

Making window widgets push other widgets around on a screen

Launching off our foundation from the previous recipe, we now get ready to have window widgets magically switch places. This will act like a game of musical chairs where when one widget moves into the place of a second, the second takes the place of the first. And unlike musical chairs, no widget loses and has to sit down until the next round.

How to do it...

The structure of the Drag.Move() object is the same. Added in this recipe is the functionality of the onEnter and onLeave events. Note how the hitters now have a class added upon entering and that class removed upon leaving to create a highlight effect. This tells the user they have dragged an item to a hittable zone.

$$('.widget').each(function(el) ...

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