返回css3完成照......登陆

css3完成照片墙动画效果

phpcn_u887332018-12-11 03:42:57240

html代码

<ul class="pic">
    <li><img src="static/images/football1.jpg" alt=""></li>
    <li><img src="static/images/football2.jpg" alt=""></li>
    <li><img src="static/images/football3.jpg" alt=""></li>
    <li><img src="static/images/football4.jpg" alt=""></li>
    <li><img src="static/images/football5.jpg" alt=""></li>
    <li><img src="static/images/football6.jpg" alt=""></li>
    <li><img src="static/images/football7.jpg" alt=""></li>
    <li><img src="static/images/football8.jpg" alt=""></li>
    <li><img src="static/images/football9.jpg" alt=""></li>
    <li><img src="static/images/football10.jpg" alt=""></li>
</ul>

css代码

<style type="text/css">
    li{margin:10px;float:left;list-style: none;}
    li,img{width: 200px;height: 250px;}
</style>

js代码

<script type="text/javascript">
    let randCss = ['bounce','flash','pulse','rubberBand','shake','swing','tada','wobble','bounceIn','bounceInDown','bounceInLeft','bounceInRight','bounceInUp'];
    $('.pic img').on('click',function(){
       $(this).removeClass();
       let randNum = parseInt(Math.random()*randCss.length);
       $(this).addClass('animated '+randCss[randNum]);
    });
</script>

效果图

QQ图片20181114103819.png

最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送