-
-
Save ControlledChaos/e20f99aecab7be6b685ae02afd16f503 to your computer and use it in GitHub Desktop.
which elements are wider than the viewport?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = []; | |
document.querySelectorAll("body *") | |
.forEach(function(elem){ | |
if(elem.getBoundingClientRect().width > document.body.getBoundingClientRect().width){ | |
list.push(elem.outerHTML.split('>')[0] + '>'); | |
} | |
}); | |
confirm( "these elements are wider than the viewport:\n\n " + list.join("\n") ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment