Created
August 15, 2019 22:56
-
-
Save davejtoews/790a1ad6c59773064cdc118b2f1b41e4 to your computer and use it in GitHub Desktop.
Detect elements which are overflowing your window and causing a side scroll.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[].forEach.call(document.querySelectorAll('*'), function(element) { | |
if (element.offsetLeft + element.offsetWidth > window.innerWidth) { | |
console.log(element); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As pointed out by @sinan-evanshunt. This can also be solved with CSS
*, *:before, *:after {outline: 1px dotted red !important;}