gsap+flip实现图片翻转切换图文效果代码

代码语言:html

所属分类:其他

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

代码标签: gsap flip 图片 翻转

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>
        * {
          margin: 0;
          padding: 0;
          font-family: poppins, sans-serif;
        }
        
        body {
        	background-color: #000;
        }
        
        h1 {
          color: #cecece;
          text-align: center;
          margin-top: 20px;
        }
        
        .main-nav {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          margin: 0;
          padding: 0;
          width: 600px;
          height: 150px;
        }
        
        .main-nav li {
          list-style: none;
          position: absolute;
          width: 200px;
          height: 200px;
          background: #000;
          transform: rotate(45deg);
          transition: 0.5s;
          margin: -100px;
          overflow: hidden;
          opacity: 0.6;
        }
        
        .main-nav li:hover {
          opacity: 1;
        }
        
        .main-nav li.item:first-child {
          top: 0;
          left: 0;
        }
        
        .main-nav li.item:nth-child(2) {
          bottom: 0;
          left: 25%;
        }
        
        .main-nav li.item:nth-child(3) {
          top: 0;
          left: 50%;
        }
        
        .main-nav li.item:nth-child(4) {
          bottom: 0;
          left: 75%;
        }
        
        .main-nav li.item:last-child {
          top: 0;
          left: 100%;
        }
        
        .main-nav li .bg {
          width: 100%;
          height: 100%;
          transform: scale(1.1);
        }
        
        .description {
          color: #fefefe;
          position: absolute;
          top: 0;
          left: 28%;
          width: 145px;
          font-size: 0.9rem;
          height: 100%;
        }
    </style>




</head>

<body translate="no">
    <h1>Click any image</h1>
    <ul class="main-nav">
        <li class="item">
            <span class="description">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to.</span>
            <img class="bg" data-flip-id="img1" src="//repo.bfw.wiki/bfwrepo/image/61ac6310a18c5.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
        </li>
        <li class="item">
            <span class="description">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to.</span>
            <img class="bg" data-flip-id.........完整代码请登录后点击上方下载按钮下载查看

网友评论0