Skip to content

Instantly share code, notes, and snippets.

@elfacht
Created January 19, 2022 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elfacht/8b4b769f5e34ff74f91c9cb181195e61 to your computer and use it in GitHub Desktop.
Save elfacht/8b4b769f5e34ff74f91c9cb181195e61 to your computer and use it in GitHub Desktop.
Find horizontal body overflow
// @source http://css-tricks.com/findingfixing-unintended-body-overflow/
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment