vue3+gsap实现图文幻灯片翻转切换效果代码

代码语言:html

所属分类:选项卡

代码描述:vue3+gsap实现图文幻灯片翻转切换效果代码

代码标签: vue3 gsap 图文 幻灯片 翻转 切换

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>
        @import url("https://fonts.googleapis.com/css2?family=Allura&family=Poppins:wght@300&display=swap");
        
        * {
          margin: 0;
          padding: 0;
          box-sizing: border-box;
        }
        
        :root {
          --green: #ecfaec;
          --dark-green: #166639;
          --white: #ffffff;
          --black: #202020;
        }
        
        body {
          min-height: 100vh;
          display: grid;
          place-items: center;
          font-family: "Poppins", sans-serif;
          background-color: var(--green);
         
          color: var(--black);
        }
        
        ul {
          list-style: none;
        }
        
        a {
          text-decoration: none;
          color: inherit;
        }
        
        .container {
          width: 100%;
          max-width: 900px;
        }
        
        header {
          padding: 2em 1em;
          display: grid;
          grid-template-columns: 100px 1fr;
          align-items: center;
        }
        header h1 {
          font-family: "Allura", serif;
          color: var(--dark-green);
        }
        header ul {
          display: flex;
        }
        header li {
          margin-right: 3em;
          font-size: 0.85rem;
          font-weight: bold;
        }
        
        section {
          width: 100%;
          padding: 1em;
        }
        
        section h4 {
          opacity: 0.8;
        }
        
        li.active {
          color: var(--dark-green);
          border-bottom: 1px solid var(--dark-green);
        }
        
        .card {
          display: grid;
          grid-template-columns: 1fr 1fr;
          grid-auto-rows: auto;
          background-color: var(--white);
          box-shadow: rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset,
            rgba(50, 50, 93, 0.25) 0px 50px 100px -20px,
            rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
        }
        
        .card-info {
          display: grid;
          grid-template-rows: repeat(3, 1fr);
          padding: 1em 2em;
        }
        .card-info h1 {
          font-family: "Allura", serif;
          font-size: 5rem;
          color: var(--dark-green);
          align-self: center;
          clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
        }
        .card-info p {
          font-size: 0.8rem;
          font-weight: bold;
          align-self: center;
          clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
          line-height: 22px;
        }
        .card-info a {
          display: grid;
          grid-template-columns: max-content 20px;
          align-items: center;
          column-gap: 7px;
          color: var(--dark-green);
          font-size: 0.85rem;
          font-weight: bold;
          align-self: center;
          justify-self: flex-end;
          transform: translateX(0px);
          transition: transform 0.3s 0.1s ease-out;
        }
        .card-info a:hover {
          transform: translateX(5px);
        }
        .card-info a:hover svg {
          transform: translateX(5px);
        }
        .card-info svg {
          width: 20px;
          height: 10px;
          transform: translateX(0px);
          transition: transform 0.3s ease-out;
        }
        .card-info svg line {
          stroke: var(--dark-green);
        }
        
        .card-photo {
          width: 450px;
          object-fit: cover;
          position: relative;
          overflow: hidden;
        }
        .card-photo img {
          display: block;
          max-width: 100%;
          aspect-ratio: 1/1;
        }
        .card-photo a {
          display: grid;
          grid-template-columns: max-content 20px;
          align-items: center;
          column-gap: 7px;
          color: var(--white);
          font-size: 1rem;
          font-weight: bold;
          letter-spacing: 1px;
          align-self: flex-start;
          transform: translateX(0px);
          transition: transform 0.3s 0.1s ease-out;
          position: absolute;
          z-index: 10;
          bottom: 5%;
          right: 8%;
        }
        .card-photo a:hover {
          transform: translateX(5px);
        }
        .card-photo a:hover svg {
          transform: translateX(5px);
        }
        .card-photo svg {
          width: 20px;
          height: 10px;
          transform: translateX(0px);
          transition: transform 0.3s ease-out;
        }
        .card-photo svg line {
          stroke: var(--white);
          stroke-width: 2;
        }
        .card-photo .mask {
          position: absolute;
          top: 0;
          height: 100%;
          width: 50%;
          z-index: 5;
          background-color: var(--white);
        }
        #mask-1 {
          left: 0;
          transform: translateY(-100%);
        }
        #mask-2 {
          right: 0;
          transform: translateY(100%);
        }
        
        @media (max-width: 600px) {
          .card {
            grid-template-columns: 1fr;
            justify-items: center;
          }
        
          .card-info {
            order: 2;
            height: 400px;
          }
          .card-photo {
            width: 100%;
            order: 1;
          }
        
          .card-photo img {
            width: 100%;
          }
        
          .card-photo .mask {
            height: 100%;
          }
        }
        
        @media (max-width: 500px) {
          header {
            padding: 1em;
            grid-template-columns: 1fr 1fr;
            align-items: flex-start;
          }
          header ul {
            flex-direction: column;
          }
          header li {
            width: min-content;
            margin-right: 0;
          }
          .card-info h1 {
            font-size: 3rem;
          }
        }
    </style>




</head>

<body>
    <div class="container" id="app">
        <header>
            <h1>Teds</h1>
            <ul>
                <li>Latest</li>
                <li>Brands</li>
                <li>Collections</li>
                <li class="active">Clearance</li>
            </ul>
        </header>

  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0