Skip to content

jQuery plugin to dynamically apply animate.css animations

License

Notifications You must be signed in to change notification settings

bitflower/animateCSS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use the animate.css animations from http://daneden.me/animate/

This is my extension on Craig Dennis' fab plugin. It allows us to pass a custom "animated" class for different timings, etc.

USAGE:

Basic

$('#your-id').animateCSS('fadeIn');

With callback

$('#your-id').animateCSS('fadeIn', function(){
    alert('Boom! Animation Complete');
});

With delay (in ms)

$('#your-id').animateCSS('fadeIn', { delay: 500 });

With delay AND callback

$('#your-id').animateCSS('fadeIn', function(){
    alert('Boom! Animation Complete');
}, {
    delay: 1000
});

With delay, callback AND custom animated class

$('#your-id').animateCSS('fadeIn', function(){
    alert('Boom! Animation Complete');
}, {
    delay: 1000,
    animateClass: 'myAnimatedClass'
});

If you want to hide an element when the page loads and then apply an effect, it might look something like this:

<style>
    .js #your-id {
        visibility:hidden;
    }
</style>

$(window).load( function(){
    $('#your-id').animateCSS('fadeIn', function(){
        alert('Boom! Animation Complete');
    }, {
        delay: 1000
    });
});

Additional options:

lastCallbackOnly: The given callback will be fired after THE LAST matching element of the selector has ended its animation.

{ 
    lastCallbackOnly : true
}

lastCallback: Optional, additional callback to be called when all animations on all mathing elements of the selector have ended their animation.

{ 
    lastCallback: function() {
        // Code ....
    }
}

Remember to use a .js (or .no-js depending on how you role) so that the element still displays for non javascript users (and Google previews).

About

jQuery plugin to dynamically apply animate.css animations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%