• 3D轮播图


    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <title>Document</title>
      <style>
        * {
          padding: 0;
          margin: 0;
          list-style: none;
        }
    
        .view {
          width: 560px;
          height: 300px;
          margin: 100px auto;
          position: relative;
    
        }
    
        ul {
          width: 100%;
          height: 100%;
          transform-style: preserve-3d;
          transform: rotate3d(1, 1, 0, 0deg);
        }
    
        ul>li {
          width: 20%;
          height: 100%;
          float: left;
          transform-style: preserve-3d;
          position: relative;
          /* 过度效果 */
          transition: transform 0.6s;
    
        }
    
        ul>li>span {
          width: 100%;
          height: 100%;
          position: absolute;
          left: 0;
          top: 0;
        }
    
        ul>li>span:nth-of-type(1) {
          background: url("./images/q1.jpg");
          /* 往z轴正方向偏移 */
          transform: translateZ(150px);
        }
    
        ul>li>span:nth-of-type(2) {
          background: url("./images/q2.jpg");
          transform: translateY(-150px) rotateX(90deg);
        }
    
        ul>li>span:nth-of-type(3) {
          background: url("./images/q3.jpg");
          transform: translateZ(-150px) rotateX(-180deg);
    
        }
    
        ul>li>span:nth-of-type(4) {
          background: url("./images/q4.jpg");
          transform: translateY(150px) rotateX(-90deg);
        }
    
        ul>li:nth-of-type(2)>span {
          background-position-x: -100%;
        }
    
        ul>li:nth-of-type(3)>span {
          background-position-x: -200%;
        }
    
        ul>li:nth-of-type(4)>span {
          background-position-x: -300%;
        }
    
        ul>li:nth-of-type(5)>span {
          background-position-x: -400%;
        }
    
        .pre,
        .next {
          width: 40px;
          height: 60px;
          font-size: 40px;
          position: absolute;
          top: 50%;
          text-decoration: none;
          text-align: center;
          line-height: 60px;
          color: #ccc;
          background-color: rgba(0, 0, 0, 0.4);
          transform: translate(0, -50%);
        }
    
        .pre {
          left: 0;
        }
    
        .next {
          right: 0;
        }
      </style>
    </head>
    
    <body>
      <div class="view">
        <ul>
          <li>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
    
          </li>
          <li>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
    
          </li>
          <li>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
    
          </li>
          <li>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
          </li>
          <li>
            <span></span>
            <span></span>
            <span></span>
            <span></span>
          </li>
        </ul>
        <a href="javascript:;" class="pre" id="pre">&lt;</a>
        <a href="javascript:;" class="next" id="next">&gt;</a>
      </div>
      <script src="./js/jquery-3.1.0.js"></script>
      <script>
        $(function () {
          var index = 0
          var flag = true;
          //右箭头
          $("#next").on("click", function () {
            if (flag == true) {
              flag = false;
              index--;
              $("li").each(function (key, value) {
                $(this).css({
                  "transform": "rotateX(" + (index * 90) + "deg)",
                  "transition-delay": (key * 0.2) + "s"
                });
              });
              setTimeout(function () {
                flag = true;
              }, 1000);
            }
          });
          //左箭头
          $("#pre").on("click", function () {
            if (flag == true) {
              flag = false;
              index++;
              $("li").each(function (key, value) {
                $(this).css({
                  "transform": "rotateX(" + (index * 90) + "deg)",
                  "transition-delay": (key * 0.2) + "s"
                });
              });
              setTimeout(function () {
                flag = true;
              }, 1000)
            }
          })
    
    
        })
      </script>
    </body>
    
    </html>

  • 相关阅读:
    Jenkins的插件管理(安装和更新插件)
    [Flutter] MacOS/Windows Flutter 环境走一遍
    [Sw] 使用 Swoole Server task/协程 处理大数据量异步任务时注意
    [Sw] Swoole-4.2.9 可以尝试愉快应用 Swoole 协程
    [PHP] 常备的现代 PHP 项目开发准备
    [SF] Symfony 标准 HttpFoundationRequest 实现分析
    [Linux] umask 从三类人群的权限中拿走权限数字
    [Design] 后端程序的高并发与异步
    [Linux]系统管理: 进程管理(ps/top/pstree/kill/pkill), 工作管理, 系统资源查看, 系统定时任务
    [FE] 有效开展一个前端项目-V2 (vuejs-templates/webpack)
  • 原文地址:https://www.cnblogs.com/tuziling/p/10072323.html
Copyright © 2020-2023  润新知