Skip to content

Instantly share code, notes, and snippets.

@codycraven
Last active March 15, 2018 18:36
Show Gist options
  • Save codycraven/d454bc3086bf885d08c4023c3b46f11a to your computer and use it in GitHub Desktop.
Save codycraven/d454bc3086bf885d08c4023c3b46f11a to your computer and use it in GitHub Desktop.
Find overflow x element in page
// via https://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