码迷,mamicode.com
首页 > Web开发 > 详细

[ jquery选择器 :animated ] 此选择器匹配所有正在执行动画效果的元素

时间:2016-06-22 00:16:26      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:

此选择器匹配所有正在执行动画效果的元素
实例:
<!DOCTYPE html>
<html lang=‘zh-cn‘>
<head>
<title>Insert you title</title>
<meta http-equiv=‘description‘ content=‘this is my page‘>
<meta http-equiv=‘keywords‘ content=‘keyword1,keyword2,keyword3‘>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type=‘text/javascript‘ src=‘./js/jquery-3.0.0.js‘></script>
<style type=‘text/css‘>
div {
    width: 100px; height: 100px; background: red; position: absolute;
}

#animat+div {
    top: 150px;
}

.focused {
    font: 400 13px/100px ‘Courier New‘; color: #FFF; text-align: center;
}
</style>
<script type=‘text/javascript‘>
    $(function(){
        setInterval(animat,1000);
        function animat(){
           $(‘#animat‘).animate({‘left‘: 500}, 1000,function(){
                if($(this).get(0).offsetLeft >=500)
                     $(this).get(0).style.left = ‘9px‘;
            });
         }
        animat(); //只有通过jQuery中"animat"动画函数执行的才有效果
        $("div:animated").addClass(‘focused‘);
    });
</script>
</head>
<body>
    <div id=‘animat‘>animat</div>
    <div id=‘no-animat‘>no-animat</div>
</body>
</html>

[ jquery选择器 :animated ] 此选择器匹配所有正在执行动画效果的元素

标签:

原文地址:http://www.cnblogs.com/mysearchblog/p/5605221.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!