GithubHelp home page GithubHelp logo

ajaxboy / animate.css.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oliver-moran/animate.css.js

0.0 2.0 0.0 144 KB

A JavaScript add-on for Animate.css

License: MIT License

JavaScript 100.00%

animate.css.js's Introduction

Animate.css.js

A JavaScript add-on to for Animate.css https://daneden.me/animate/.

The script adds an animate() method to JavaScript's HTMLElement prototype so that Animate.css animations can be called directly on HTML elements from JavaScript:

HTMLElement.animate(String animation, [Function callback[, Object context]])
  • animation: the name of an animation in the Animate.css library (e.g. "tada")
  • callback: an optional function to call when the animation is complete
  • context: the context object (this) that is applied to the callback

Examples

<!-- Download animate.min.css from here: https://daneden.me/animate/ -->
<link rel="stylesheet" type="text/css" href="animate.min.css">

<!-- Link to the Animate.css.js library -->
<script type="text/javascript" src="animate.css.min.js"></script>

<!-- click to animate -->
<button id="button" onclick="this.animate('tada');">Click Me</button>

<script type="text/javascript">

var el = document.getElementById("button");

el.animate('tada'); // performs the 'tada' animation
el.animate('tada', callback); // "Animate.css done! [object Window]"
el.animate('tada', callback, document); // "Animate.css done! [object HTMLDocument]"

// the callback function used above
function callback(){
  alert("Animate.css done! " + this);
}

</script>

jQuery plugin

A jQuery plugin is provided with the script. To use the plugin, include both the main script file and the jQuery plugin file:

<link rel="stylesheet" type="text/css" href="animate.min.css">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="animate.css.min.js"></script>
<script type="text/javascript" src="jquery.animate.css.min.js"></script>

<button id="button" onclick="$(this).animate2('tada');">Click Me</button>

The plugin adds a animate2() method to jQuery that accepts the same parameters as the HTMLElement add-on. The plugin fully supports collections and chaining, allowing multiple elements to be animated simultaneously in one line of code.

animate.css.js's People

Contributors

oliver-moran avatar

Watchers

James Cloos avatar Cj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.