scroll 事件

2017-06-19 11:24:00
admin
原创
599
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html>
<html>
<head>
    <title>Scroll Event Example</title>
    <script type="text/javascript" src="http://code.ybao.org/demo/js/EventUtil.js"></script>
</head>
<body>
    <p style="height: 10000px">Scroll event example - scroll the browser window.</p>
    <script type="text/javascript">
        EventUtil.addHandler(window, "scroll", function(event){
            if (document.compatMode == "CSS1Compat"){
                alert(document.documentElement.scrollTop);
            } else {
                alert(document.body.scrollTop);
            }
        });
    </script>
</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络