码迷,mamicode.com
首页 > 其他好文 > 详细

抛物线

时间:2018-12-12 22:38:35      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:ryu   color   meta   line   end   fadeout   tac   animate   offset   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div.panel{
            width: 400px;
            height: 500px;
            border: 1px solid #000;
            float: left;
        }
        .btn{
            width: 100px;
            height: 100px;
            background: red;
        }
    </style>
</head>
<body>
<div class="btn"></div>
<div class="panel">
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫飞飞
    </div>
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫飘飘
    </div>
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫爬爬
    </div>
</div>
<div class="panel target">
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫飞飞
    </div>
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫飘飘
    </div>
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫爬爬
    </div>
</div>
<div class="panel">
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫飞飞
    </div>
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫飘飘
    </div>
    <div class="item">
        <img class="photo" src="http://placekitten.com/150" width="100" height="100" />
        小猫爬爬
    </div>
</div>

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

<script>
    $(‘div.item‘).on(‘click‘, function(){
        var $orgImg = $(‘img‘, this);
        console.log($orgImg[0])
        var $targetDiv = $(‘div.target‘);
        console.log($targetDiv[0])
        var $fxImg = $orgImg.clone().css({
            ‘position‘: ‘absolute‘,
            ‘z-index‘: 10000,
            ‘width‘: $orgImg.width(),
            ‘height‘: $orgImg.height(),
            ‘border-radius‘: ‘50%‘
        }).css($orgImg.offset()).appendTo(‘body‘);
        $fxImg
            .animate({
                left: [$targetDiv.offset().left + $targetDiv.width() - $fxImg.width(), ‘linear‘],
                top: [$targetDiv.offset().top + $targetDiv.height() - $fxImg.height(), ‘easeInBack‘]
            }, 600)
            .fadeOut(200, function () {
                $fxImg.detach();
            });
    });
</script>
</body>
</html>

 

抛物线

标签:ryu   color   meta   line   end   fadeout   tac   animate   offset   

原文地址:https://www.cnblogs.com/1rookie/p/10111373.html

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