Add bugs to your website
See the codeAdd bugs to your page.
See project page: http://auz.github.io/Bug/
None, all native js code
Works on all browsers that support CSS3 transforms, even mobile (that I've tested).
See http://caniuse.com/transforms2d
Include the JS somewhere, and then initialize with
new BugController();
or
new BugController({'minBugs':10, 'maxBugs':50, 'mouseOver':'die'});
You can use SpiderController() as a shortcut for loading options and the sprite for the spiders.
new SpiderController({'minBugs':2, 'maxBugs':6});
See example.html
BugController constructor can optionally take an object of options. To make this js more async friendly, you can adjust the default options at the top of bug.js, and then instantiate at the bottom of the file as above. This will allow one to wrap the entire script in a closure to prevent any global window name space overlaps.
Async code:
var targethead = window.document.getElementsByTagName("head")[0],
loadedSpiders = false,
jst = window.document.createElement("script");
jst.async = true;
jst.type = "text/javascript";
jst.src = "/path/to/bug-min.js";
jst.onload = jst.onreadystatechange = function() {
if (!loadedSpiders && (!this.readyState || this.readyState == 'complete')) {
loadedSpiders = true;
// start fire the JS.
new BugController();
}
};
targethead.appendChild(jst);
Original Screen Bug http://screen-bug.googlecode.com/git/index.html
Released under WTFPL license.
JavaScript
99.3%
Add bugs to your website
See the codeAdd bugs to your page.
See project page: http://auz.github.io/Bug/
None, all native js code
Works on all browsers that support CSS3 transforms, even mobile (that I've tested).
See http://caniuse.com/transforms2d
Include the JS somewhere, and then initialize with
new BugController();
or
new BugController({'minBugs':10, 'maxBugs':50, 'mouseOver':'die'});
You can use SpiderController() as a shortcut for loading options and the sprite for the spiders.
new SpiderController({'minBugs':2, 'maxBugs':6});
See example.html
BugController constructor can optionally take an object of options. To make this js more async friendly, you can adjust the default options at the top of bug.js, and then instantiate at the bottom of the file as above. This will allow one to wrap the entire script in a closure to prevent any global window name space overlaps.
Async code:
var targethead = window.document.getElementsByTagName("head")[0],
loadedSpiders = false,
jst = window.document.createElement("script");
jst.async = true;
jst.type = "text/javascript";
jst.src = "/path/to/bug-min.js";
jst.onload = jst.onreadystatechange = function() {
if (!loadedSpiders && (!this.readyState || this.readyState == 'complete')) {
loadedSpiders = true;
// start fire the JS.
new BugController();
}
};
targethead.appendChild(jst);
Original Screen Bug http://screen-bug.googlecode.com/git/index.html
Released under WTFPL license.
JavaScript
99.3%