Skip to content

Instantly share code, notes, and snippets.

@ahsankhatri
Last active August 29, 2015 14:22
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 ahsankhatri/5ad3ba8ef256ba4a12a9 to your computer and use it in GitHub Desktop.
Save ahsankhatri/5ad3ba8ef256ba4a12a9 to your computer and use it in GitHub Desktop.
[JS] Find body overflow element..
/*
* Reference: https://css-tricks.com/findingfixing-unintended-body-overflow/
* Uses: Run it on console..
*/
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