Skip to content

Instantly share code, notes, and snippets.

@jaredjburgess
Created April 22, 2016 14:06
Show Gist options
  • Save jaredjburgess/3cd5c247fcc62c722ecf83b470ad4689 to your computer and use it in GitHub Desktop.
Save jaredjburgess/3cd5c247fcc62c722ecf83b470ad4689 to your computer and use it in GitHub Desktop.
A function to find which element is causing unintented 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