zoukankan      html  css  js  c++  java
  • css视觉差滚动

    html {
            overflow: hidden;
            height: 100%
        }
    
        body {
            /* 视差元素的父级需要3D视角 */
            perspective: 1px;
            transform-style: preserve-3d; 
            height: 100%;
            overflow-y: scroll;
            overflow-x: hidden;
        }
        #app{
            width: 100vw;
            height:200vh;
            background:skyblue;
            padding-top:100px;
        }
        .one{
            width:500px;
            height:200px;
            background:#409eff;
            transform: translateZ(0px);
            margin-bottom: 50px;
        }
        .two{
            width:500px;
            height:200px;
            background:#67c23a;
            transform: translateZ(-1px);
            margin-bottom: 150px;
        }
        .three{
            width:500px;
            height:200px;
            background:#e6a23c;
            transform: translateZ(-2px);
            margin-bottom: 150px;
        }
    div {
                height: 100vh;
                background: rgba(0, 0, 0, .7);
                color: #fff;
                line-height: 100vh;
                text-align: center;
                font-size: 20vh;
            }
    
            .a-img1 {
                background-image: url(1.jpg);
                background-attachment: fixed;
                background-size: cover;
                background-position: center center;
            }
    
            .a-img2 {
                background-image: url(2.jpg);
                background-attachment: fixed;
                background-size: cover;
                background-position: center center;
            }
    
            .a-img3 {
                background-image: url(3.jpg);
                background-attachment: fixed;
                background-size: cover;
                background-position: center center;
            }
    <div id="app">
            <div class="one">one</div>
            <div class="two">two</div>
            <div class="three">three</div>
        </div>
        
        <div class="a-text">1</div>
        <div class="a-img1">2</div>
        <div class="a-text">3</div>
        <div class="a-img2">4</div>
        <div class="a-text">5</div>
        <div class="a-img3">6</div>
        <div class="a-text">7</div>
  • 相关阅读:
    背景大图隔几秒切换(非轮播,淡入淡出)--变形金刚joy007 项目总结
    call(京基填小票拍照片)
    加载图片、倒计时--Columbia项目总结
    kellogg项目总结
    js 跨域
    js 继承inheritance/extends
    一号店分享会
    日历,类似旅行网站的酒店入住
    js 数组的判断
    Building a Non-blocking TCP server using OTP principles
  • 原文地址:https://www.cnblogs.com/liufeiran/p/14684312.html
Copyright © 2011-2022 走看看