If a div is set as overflow:auto, how can I find out (using plain JS) if a scrollbar (Vertical / Horizontal) has been rendered?
Asked
Active
Viewed 2.4k times
32
KJ Saxena
- 20,810
- 24
- 79
- 106
1 Answers
52
Check if clientHeight is smaller than scrollHeight.
-
4Finding every element on page that has a scrollbar `[...document.querySelectorAll('*')].filter(x => x.clientHeight < x.scrollHeight)` – A1rPun Aug 27 '19 at 08:35