Fork me on GitHub

frequency.js

Periodic blinkers, XKCD-style


HEARTBEAT BIRTHS DEATHS EARTHQUAKES



frequency.js is a tiny JavaScript library to display periodic events by flashing HTML elements, inspired by XKCD's 1331st webcomic, Frequency. It requires jQuery.

Set up your script tags:
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="/path/to/frequency.js"></script>

Add the attribute data-frequency="<time period in seconds>" to any element that you want to flash:
<span data-frequency="2.71828">This will flash once in 2.71828 seconds.</span>
<span data-frequency="10">This will flash once in 10 seconds.</span>

That gives us:
This will flash once in 2.71828 seconds.
This will flash once in 10 seconds.