Making a little duck bounce when clicked

This is arguably useful at best, but, goodness gracious, it is goobly goblets of fun!

Making a little duck bounce when clicked

Getting ready

Position the standing and bouncing versions of our duck, stacked in absolute positioning so that the standing version obscures the bouncing version.

<div id="main">
<div id="duck_it">
<img src="08_duck_bounce.jpg" alt="Ouch!"
title="Ouch!" id="bounce"/>
<img src="08_duck_stand.jpg" alt="Click me!"
title="Click me!" id="stand"/>
</div>
</div>
<style type="text/css">
#main { width:600px; margin:auto; }
#duck_it { margin-top:10px; cursor:pointer; }
#duck_it img { position:absolute; }
</style>

How to do it...

The ...

Get MooTools 1.3 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.