阅读背景:

水平滚动事件无法在IE上运行? (似乎没有其他事件正在发挥作用)

来源:互联网 
<!DOCTYPE html>
<html>
<head>
<style>
    #myDIV {
        height: 250px;
        width: 250px;
        overflow: auto;
    }
#content {
        height: 800px;
        width: 2000px;
        background-color: coral;
    }
</style>
</head>
<body>
<p>Scroll inside the div element to display the number of pixels the content of div is scrolled horizontally and vertically.</p>

<div id="myDIV">
    <div id="content">Scroll inside me!</div>
</div>

<p id="demo"></p>

<script>

    document.getElementById("myDIV").addEventListener('scroll', function (e) {
        alert("scroll");
    });
    document.getElementById("myDIV").addEventListener('click', function (e) {
        alert("click");
    });

</script>
<!DOCTYPE html>
<html>
<head>
<style>
    #myDI



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: