Skip to content

Lightweight port from the original Zurb Raptorize made with modern technologies.

Notifications You must be signed in to change notification settings

formaweb/vanilla-raptorize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Vanilla Raptorize

This is a lightweight port from the original Zurb Raptorize made with modern technologies.

Usage

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();

Configurations

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
});

Examples

Click Event

var myRaptor = Raptorize();

// Without jQuery
document.querySelector('my-selector').addEventListener('click', myRaptor.go);

// With jQuery
$('my-selector').on('click', myRaptor.go);

Konami Code

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.

About

Lightweight port from the original Zurb Raptorize made with modern technologies.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published