Last active
March 8, 2017 18:56
-
-
Save tinacious/7c3e817391469550922a109f40410e26 to your computer and use it in GitHub Desktop.
Prompts the user for a width value in pixels and then finds all DOM elements greater than the provided width
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
/** | |
* Prompts the user for a width value in pixels and then | |
* finds all DOM elements greater than the provided width | |
*/ | |
(function () { | |
const desiredWidth = Number(prompt('Wider than what? (px)')); | |
document.body.querySelectorAll('*') | |
.forEach((item) => { | |
var width = item.offsetWidth; | |
if (width > desiredWidth) console.log('Too big 🙅🏻', item); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment