Created
May 18, 2015 21:48
-
-
Save nlebert-linux/dab36ebe12d952b6c6c8 to your computer and use it in GitHub Desktop.
Find HTML elements that are causing overflow and expanding 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
// custom node array iteration function | |
var nodeArray = function (array, callback, scope) { | |
for (var i=0; i < array.length; i++) { | |
callback.call(scope, i, array[i]); // Return each element | |
} | |
} | |
// Document Width | |
docWidth = document.documentElement.offsetWidth; | |
nodes = document.querySelectorAll('*'); | |
nodeArray(nodes, function (index, value) { | |
if (value.offsetWidth > docWidth) { | |
console.log(value); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment