ANIMATE.CSS Basic Use Method

Source: Internet
Author: User

Animate.css is a bunch of cool, fun, cross-browser animation libraries that you can use in your projects at your own discretion. Use it anywhere you want to highlight, such as the home page, slider, which is as easy as drinking water and is a dead fan.

Usage

Using ANIMATE.CSS on your site, simply insert the stylesheet into the document and add a CSS class name to the element that needs animation, as well as the name of the animation. That's it! You'll have a CSS animation effect. Super strong!

<head>  <link rel="stylesheet" href="animate.min.css"></head>

When combined with jquery, you can decide when to enable these animations and add animations using jquery dynamically, and you can do more things:

$(‘#yourElement‘).addClass(‘animated bounceOutLeft‘);

You can also detect end-of-animation events:

$(‘#yourElement‘).one(‘webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend‘doSomething);

Note: Jquery.one () performs event processing at most once. Click here to learn more.

You can change the duration of the animation, increase the delay, or change the display count:

#yourElement{  -vendor-animation-duration: 3s;  -vendor-animation-delay: 2s;  -vendor-animation-iteration-count: infinite;}

Note: Be sure to replace "vendor" with the prefix of CSS Tian (WebKit, Moz, etc.)

<! DOCTYPE html><html>    <head>        <meta charset="UTF-8">        <title></title>        <link rel="stylesheet" type="text/css" href ="Css/animate.css"/>        <style type="Text/css">  #ball  {width : 200  px  ; height :    px  ; background :   #F08080   ; border-radius :  50 %  ; margin :   px Auto  ;    </style>        <script src="js/jquery-2.2.3.min.js" type="Text/javascript " CharSet="Utf-8"></script>    </head>    <body>        <div class="Animated Bouncein" id="Ball">        </div>        <div class="Input-ui">             <input type="text" name= "" " id=" "  Value="" class="Input-ui-txt" />             <input type="button" name= "" " id=" changeanimation " value=" Change animation " />        </div>        <script type="Text/javascript">( function($){                //console.log ($ ('. Ball '));                 function changeanimations(ele,type){                    if(typeofEle = = =' String ') {$ (ele). Removeclass (). addclass (Type +' animated '). One (' webkitanimationend mozanimationend msanimationend oanimationend animationend ', function(){$( This). Removeclass (); });return; } ele.removeclass (). addclass (Type +' animated '). One (' webkitanimationend mozanimationend msanimationend oanimationend animationend ', function(){$( This). Removeclass ();                }); }varInput = $ ('. Input-ui-txt ');varBall = $ (' #ball '); $("#changeanimation"). Click ( function(event){Event.preventdefault (); Event.stoppropagation ();varval = Input.val ();                Changeanimations (Ball,val);            }); })($);</script>    </body></html>

ANIMATE.CSS Basic Use Method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.