判断页面中是否有滚动条

<!doctype html>
<html><head>
    <meta charset="utf-8">
    <title>一篇很长的文章</title>
    <script language="javascript" src="jquery-1.4.4.min.js"></script>
    <script language="javascript">
        $(document).ready(function(){
            /*if (document.documentElement.clientWidth > document.documentElement.offsetWidth-4){
                alert("有滚动条");
            }*///思路是判定可视窗口高度或宽度是否小于实际页面高度或宽度
            $("body").scrollTop(10);//控制滚动条下移10px
            if( $("body").scrollTop()>0 ){
                alert("有滚动条");
            }else{
                alert("没有滚动条");
            }
            $("body").scrollTop(0);//滚动条返回顶部
        });
    </script>
</head>
<body>
<p>。。。。。。。。</p>
</body>

</html>

原文地址:https://www.cnblogs.com/mina-huojian66/p/6150271.html