This is a lightweight port from the original Zurb Raptorize made with modern technologies.
First of all, you'll need instance that:
var myRaptor = Raptorize();
Then, when you want to see El Raptor on your screen, just call him like this:
myRaptor.go();
These are our defaults:
{
audioPath: ['assets/sounds/raptor.mp3', 'assets/sounds/raptor.ogg'],
imagePath: 'assets/images/raptor.png',
className: 'raptor',
animationTime: 2000
}
You can override any option:
var myRaptor = Raptorize({
className: 'el-raptor',
animationTime: 500
});
var myRaptor = Raptorize();
// Without jQuery
document.querySelector('my-selector').addEventListener('click', myRaptor.go);
// With jQuery
$('my-selector').on('click', myRaptor.go);
var myRaptor, konamiIndex, konamiCode;
myRaptor = Raptorize();
konamiIndex = 0;
konamiCode = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13];
window.addEventListener('keydown', function(event) {
if (event.keyCode === konamiCode[konamiIndex]) {
konamiIndex++;
if (konamiIndex == konamiCode.length) { myRaptor.go(); }
} else {
konamiIndex = 0;
}
});
That's all, folks.