jQuery

【jQuery】コンテンツが見えてきたときにのみアニメーションを有効にするjQuery AniView

October 29, 2016
jQuery AniView

jQuery AniViewはコンテンツが見えてきたときにのみアニメーションを有効にし、animate.cssと動作するjQueryプラグイン。

CDN

<script src="https://unpkg.com/jquery-aniview/dist/jquery.aniview.js">

Initialisation

$('.aniview').AniView();

Options

var options = {
    animateThreshold: 100,
    scrollPollInterval: 50
}
$('.aniview').AniView(options);
animateThreshold 0
scrollPollInterval 20

Markup

<div class="aniview" data-av-animation="slideInRight"></div>

Full Example

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>My AniView Page</title>
    <link type="text/css" rel="stylesheet" href="animate.css">
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="jquery.aniview.js"></script>
    <script>
        $(document).ready(function(){
            $('.aniview').AniView();
        });
    </script>
</head>
<body>
    <div>
        <p class="aniview" data-av-animation="slideInRight">
            This is my awesome animated element!
        </p>
    </div>
</body>
</html>