您当前的位置: 首页 >  html

【03】

暂无认证

  • 1浏览

    0关注

    196博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

html引导页的实现

【03】 发布时间:2021-01-11 11:44:33 ,浏览量:1

引导页穿透层思路

使用无限大的阴影

禁用滚动思路

使用js禁用body的touchmove事件

禁用里层点击

使用一个透明层遮住

动画

使用transition过渡即可

实现代码
doctype html>


    
    
    
    web03.cn
    
        html,body{
            width: 100%;
            height: 100%;
        }
        .guide-box{
            width: 100%;
            height: 100%;
            position: fixed;
            left: 0;
            top: 0;
        }
        .guide-box > .guide{
            position: fixed;
            left: 50%;
            top: 50%;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            box-shadow: 1px 1px 100000px 100000px rgba(0,0,0,0.5);
            transition: all 500ms;
        }
        .step{
            width: 200px;
            height: 200px;
            text-align: center;
            line-height: 200px;
            display: inline-block;
        }
        .guide-tip{
            position: absolute;
            left: 50%;
            top: 100%;
            transform: translateX(-50%);
            white-space: nowrap;
        }
    



    
        步骤1
    


    
    步骤2
    


    
    步骤3
    


    
    步骤4
    


    
    步骤5
    


    
        
            上一步
            下一步
        
        
    



    // 禁用滚动给
    document.body.addEventListener('touchmove', function (e) {
        e.preventDefault();
    }, { passive: false });
    let steps = document.getElementsByClassName('step-address')
    let guide = document.getElementsByClassName('guide')[0]
    let stepIndex = 0
    document.getElementsByClassName('pre')[0].onclick = function(){
        stepIndex -= 1
        if (stepIndex4){
            stepIndex = 4
        } else {
            runGuide()
        }
    }
    runGuide()
    function runGuide (){
        guide.style.left = steps[stepIndex].offsetLeft + steps[stepIndex].clientWidth/2 - guide.clientWidth/2 + 'px'
        guide.style.top = steps[stepIndex].offsetTop + steps[stepIndex].clientHeight/2 - guide.clientHeight/2 + 'px'

    }


效果

关注
打赏
1657344724
查看更多评论
立即登录/注册

微信扫码登录

0.0406s