table图制作+滚动条(拉动滚动条时,图标隐藏 再拉动时,图片显示)

<!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">
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/comm.css">
    <title>滚动条滚动</title>
</head>
<body>
    <a name="m15"></a>   //首先进行锚点
 <div class="m1">
        <div class="m13">
            <ul class="m10">
                <li class="m11"><img src="img/ss1.png" alt=""></li>
                <li><img src="img/ss2.png" alt=""></li>
                <li><img src="img/ss3.png" alt=""></li>
                <li><img src="img/ss4.png" alt=""></li>
                <li><a id="hello" href="#m15"><img src="img/sss.png" alt=""></a></li>      //锚点    需要和顶部锚点同时写入html中
            </ul>
            <div class="m12">
                <div class="q1" style="display: block;">
                    <div class="m2">
                        <div class="m3 cl">
                            <input class="m4" type="text" placeholder="">
                            <div class="cl m5">
                                <p class="fl">您可输入30个字</p>
                                <div class="fr"><img src="img/SS5.png" alt=""></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="q1">
                    <div class="m2">
                        <div class="m3 cl">
                            <div class="m6"><img src="img/ss6.png" alt=""></div>
                        </div>
                    </div>
                </div>
                <div class="q1">
                    <div class="m2">
                        <div class="m6 cl">
                            <ul cl>
                                <li><img src="img/ss7.png" alt="">
                                    <p>工银融e行</p>
                                </li>
                                <li><img src="img/ss8.png" alt="">
                                    <p>工银融e联</p>
                                </li>
                                <li><img src="img/ss9.png" alt="">
                                    <p>工银融e购</p>
                                </li>
                            </ul>

                        </div>
                    </div>
                </div>
                <div class="q1">
                    <div class="m2">
                        <div class="m7"><img src="img/ssssssss.png" alt=""></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script src="js/jquery-3.4.1.js"></script>     //js库
<script src="js/comm.js"></script>              //自己写的代码
</html>
 
css 部分
.m1{
    position: fixed;
    top: 420px;
    right: 0;
    min-height: 280px;
    z-index: 1000;
}
.m1 ul li{
    width: 35px;
    height: 35px;
    margin-bottom: 4px;
    cursor: pointer;
    list-style: none outside none;
    display: table;
    zoom: 1;
    position: relative;
}
.m2{
    width: 300px;
    height: 165px;
    background-color: #fff;
    position: absolute;
    top: 0;
    left: -300px;
    z-index: 10;
}
.m3 .m4{
    height: 90px;
    width: 240px;
    margin-left: 25px;
    margin-top: 20px;
}
.m5 p{
    color: #a7a7a7;
    font-size: 14px;
    line-height: 2;
    margin-top: 1px;
    margin-left: 25px;
    cursor: pointer;
}
.m5 img{
    margin-right: 30px;
    margin-top: 3px;
    cursor: pointer;
}
.m6{
    margin-top: 40px;
    margin-left: 5px;
}
.m6 ul li{
    float: left;
    margin-left: 10px;
}
.m6 ul li p{
    margin-left: 5px;
}
.m7{
    margin-top: 40px;
    margin-left: 20px;
}
.m12{
    right: 0;
    display: none;
}
 
js部分
table图制作部分:
$(".m10 li").mouseover(function () {
    console.log("鼠标移入")
    $(this).addClass("m11").siblings().removeClass("m11");
    var i = $(this).index();
    $(this).parent().next(".m12").find(".q1").eq(i).show().siblings().hide();
    $(this).parent().next(".m12").show();
});
$(".m13").mouseleave(function () {
    console.log("鼠标移出")
$(".m12").hide();
})
滚动部分:
onscroll = function (){
    var st = document.documentElement.scrollTop || document.body.scrollTop;
    if (!hello.offsetWidth && st >= 400){
         hello.style.display = 'block';
        }
        else if (!!hello.offsetWidth && st < 400){
         hello.style.display = 'none';
        }
    }
 
 
欢迎各位大神指点 评论;

猜你喜欢

转载自www.cnblogs.com/lxc127136/p/12121730.html