No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



jInsects is a jQuery plugin which generates bugs under the specified element which then run off screen.

This concept for this idea came from Lee and the implementation by Tom Oram.


Include jQuery and jInsect into your HTML page:

<script src=""></script>
<script src="js/jquery.insects.js"></script>

Call $.insectify() on the element you want to apply insects to:


A typical use for this plugin would be to have insects hiding under a popup, this can be done like so:

<script type="text/javascript">
$(document).ready(function () {
		function () {
		function () {

Please note that $.insectify() must be called before $.hide() as it needs the element to be displayed when it is called so it can get the position.

The above code would work on some HTML similar to this:

<a href="#" id="activate'>Hover over me</a>
<div id="popup" style="display: hidden;">Popup contents</div>

Options can be passed to the $.insectify() method like so:

	'max-insects': 5,
	'chance': 0.8

For a list of all available objects see the next section.


  • max-insects: The maximum number of insects that could be hiding under the element.
    • Type: Integer
    • Default: 3
  • chance: The chance that there will be insects hiding. A value of 1 means there will always be insects hiding.
    • Type: Float
    • Range: 0-1
    • Default: 0.5
  • min-speed: The minimum possible speed of an insect.
    • Type: Integer
    • Range: 1-10 recommended
    • Default: 5
  • max-speed: The maximum possible speed of an insect.
    • Type: Integer
    • Range: 1-20 recommended
    • Default: 15
  • update-freq: The time between updates of the insect sprites in milliseconds. Lower is smoother but more CPU intensive.
    • Type: Integer
    • Range: 1-1000
    • Default: 50
  • mouse-trigger: Whether the insects accellerate when the mouse is near.
    • Type: Boolean
    • Default: true
  • mouse-distance: The distance between the mouse & the insect that triggers an action (in pixels).
    • Type: Integer
    • Range: 10-100 recommended
    • Default: 50
  • scared: If set to true then when the insect approaches the mouse head on it will turn to avoid the mouse.
    • Type: Boolean
    • Default: true
  • squishable: If set to true the insects get splatted on the page if clicked.
    • Type: Boolean
    • Default: true


Tom Oram's Development Blog