-
-
Save sadeghbarati/25c417c717610b8c24177ee291d54cbd 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