Spice Up Your Next Web Demo with Bats

I decided to add a little spice to a web demo that happens to fall on Halloween.  Thanks to Eric Grange over at DelphiTools, it was super easy.

I updated his script slightly, to allow control over when the bats appear (and how many there are).  You can include my js file directly, or download here, or clone from the github repo.  To use it, follow these steps:

First - Include the script in your header. This line uses my host for your convenience, but you can just download the file and use it directly.

<script src="http://static.twomile.com/bats.js"></script>

Then, somewhere in your javascript call makeBats() and give it the number of bats you want to appear. You can start them when the page loads, or as a reward for clicking a certain button. The world is your oyster, developer.

new BatManager().makeBats(15);

That's it!  Let me know what fun you have with it, and be sure to thank Eric for the original.

This article was updated on October 29, 2024

✍️ Comments or questions? Get in touch: corey {at} coreysnipes.com, or on Mastodon.