// originaly based on code from https://css-tricks.com/findingfixing-unintended-body-overflow/ | |
// improved to handle absolute positioned elements shifted to right making overflow happend. | |
function findOverflow(){ | |
var docWidth = document.documentElement.offsetWidth; | |
[].forEach.call( | |
document.querySelectorAll('*'), | |
function(el) { | |
var rect= el.getBoundingClientRect(); | |
if (el.offsetWidth > docWidth ||rect.right>docWidth) { | |
console.log(el); | |
} | |
} | |
); | |
} | |
findOverflow(); // call it as script loads. Also you can call it later manually from a console. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment