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); | |
} | |
}); |
As pointed out by @sinan-evanshunt. This can also be solved with CSS
*, *:before, *:after {outline: 1px dotted red !important;}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Paste the above into your console or into a javascript file in a section of code that runs after page load. Any element which overflows the window will be output to the console.