Wandering Hearts

I first wrote a wandering hearts script in 2005 as a script with a Valentine's day theme. JavaScript has changed dramatically since then and so this new unobtrusive version has little in common with that previous one (the code is completely different although the overall result is very similar).

This new wandering hearts script makes use of the $B, $E, and $O objects that provide cross browser code for interacting with the browser, events, and an element in the web page respectively. These three scripts (which have all been included together in dollar.js) are only needed once in your page regardless of how many scripts your page contains that uses them. The actual wandering heart functionality is relatively small and is set up so you just need to specify the path to where you put the image in the very last line. You can of course substitute your own image if you want two of something else wandering around the browser viewport in front of your page..

Download a complete copy of the Wandering Hearts script. You can then add the script to your page by placing the following immediately before the </body> tag.

<script type="text/javascript" src="dollar.js"></script>
<script type="text/javascript" src="hearts.js"></script>


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow