Do you remember those cheats and easter eggs that you used to trigger on your NES and GameBoy games by pressing a certain sequence of buttons? Now you can add them to your pages with this tiny jQuery plugin!
Try pressing the following sequence of keys:
↑↑↓↓←→←→BA
If you already have jQuery on your site, then it's just a matter of downloading this plugin and loading it into your page. Then just call the easteregg
method on any element you want, providing a callback (callback
property) and the sequence of keys that will trigger it (sequence
property):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Easter Egg</title>
</head>
<body>
<script src="jquery.min.js"></script>
<script src="jquery.easteregg.min.js"></script>
<script>
$(function () {
$(document).easteregg({
sequence : [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]
, callback : function () {
alert('Pizza time!');
}
});
});
</script>
</body>
</html>
If no sequence
is provided, the Konami Code sequence will be used (↑↑↓↓←→←→BA).
git clone git://github.com/unindented/jquery-easteregg.git
Copyright (c) 2012 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.