博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js鼠标滚轮事件
阅读量:7087 次
发布时间:2019-06-28

本文共 699 字,大约阅读时间需要 2 分钟。

hot3.png

<!DOCTYPE html>

<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <style>
        *,body{
            margin: 0;
            padding: 0;
            font-family: "微软雅黑";  
            text-align: center;
        }
        .wrap{
            position:relative;
            z-index: 1;
            height: 2000px;
        }
        .wrap p{
           padding-top: 320px;
        }
        #zmkt{
            position: absolute;
            top:0;
            left: 50%;
            margin-left: -150px;
            width: 300px;
            height:300px;
            background-color:aliceblue;
            line-height: 300px;
        }
    </style>
    <script>
    </script>
</head>
<body>
    <div class="wrap">
        <div id="zmkt">色块</div>
        <p id="Otext">鼠标滚动时,色块距离顶部200px<p>
    </div>
    <script type="text/javascript">
    window.onmousewheel=function(){
        document.getElementById('zmkt').style.top="200px";
    }

    </script>
</body>
</html>

转载于:https://my.oschina.net/kitty0107/blog/1625090

你可能感兴趣的文章
YZMHelper(验证码类)
查看>>
解决 “VS2005 这个产品的配置数据已损坏。请与技术支持人员联系”不能部署的问题...
查看>>
AWS 学习之路(技术专业人员Training and Certification)核心服务部分
查看>>
第二次作业--邓琨
查看>>
Here's to the crazy ones(苹果的价值观)
查看>>
【HDOJ】1408 盐水的故事
查看>>
POJ2155 Matrix(二维树状数组)
查看>>
leetcode 172. Factorial Trailing Zeroes
查看>>
日常总结!!!
查看>>
Fidder的几点补充
查看>>
最佳sql server 分页查询
查看>>
如何改变EntityFramework的代码生成策略
查看>>
GO语言的进阶之路-面向对象编程
查看>>
Nginx的基本配置案例
查看>>
洛谷P3183 [HAOI2016]食物链
查看>>
[JVM] - 不就是JVM么 JVM的继续探究
查看>>
MySQL区间检索
查看>>
通俗解释主要编程语言及其用途
查看>>
近期工作量统计
查看>>
GoLang simple-project-demo-03
查看>>