3D旋转卡片|js入门案例

<!doctype html>
    <html lang="zh">
       <head>
           <meta charset="utf-80">
           <title>welcome my web site</title>
           <style>
               *{
                   margin: 0;
                   padding: 0;
               }
               .box{
                   /*相对定位*/
                   position: relative;
                   display: flex;
                   width: 500px;
                   height: 500px;
                   border: 2px solid red;
                   
               }
               .box div{
                   /*过度动画*/
                   transition: all 1s;
                   /*绝对定位*/
                 position: absolute;
                 top: 100px;
                 width: 200px;
                 height: 300px; 
                 /*设置圆角*/
                 border-radius: 20px;
                 /*加阴影*/
                 box-shadow: 2px 2px 15px rgba(0,0,0, .2);
                 
               }
               .left{
                   z-index: 0;
                   left: 0px;
                   /*缩放*/
                   transform: scale(0.8);
               }
               .center{
                   left: 150px;
                   z-index: 2;
               }
               .right{
                   z-index: 0;
                   left: 300px;
                   transform: scale(0.8);
               }
           </style>
       </head> 
       <body>
           
           <div class="box">
               <div class="left" style="background:red;"></div>
               <div class="center" style="background:blue;"></div>
               <div class="right" style="background:green;"></div>
           </div>
           
           <script>
               
               setinterval(()=>{
               let left = document.queryselector('.left')
               let center = document.queryselector('.center')
               let right = document.queryselector('.right')
               
                   left.classname = 'center'
                   center.classname = 'right'
                   right.classname = 'left'
               },1000)
           </script>
       </body>
    </html>

上述代码本人练习作品,小白拿过去研究研究,大佬请绕走!

图片[1]-3D旋转卡片|js入门案例-Waris

版权声明

1 本网站名称:Waris 资源库
2 本站永久网址:https://www.waric.cn
3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长微信Uyweb_cn,进行删除处理。
4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
5 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6 本站部分资源存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
7 本站付费资源只收资源价格,售后另收费用,远程协助一般50¥起步!

© 版权声明
THE END
喜欢就支持一下吧
点赞15赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码

    暂无评论内容