Detect if a page has a vertical scrollbar?

后端 未结 13 1828
旧时难觅i
旧时难觅i 2020-11-28 02:17

I just want some simple JQ/JS to check if the current page/window (not a particular element) has a vertical scrollbar.

Googling gives me stuff that seems overly comp

13条回答
  •  旧时难觅i
    2020-11-28 03:05

    I use

    function windowHasScroll()
    {
        return document.body.clientHeight > document.documentElement.clientHeight;
    }
    

提交回复
热议问题