Created
October 17, 2014 21:38
-
-
Save dstevensio/42c9cf7f6b26c6ef55ea to your computer and use it in GitHub Desktop.
Quick and dirty utility to find all elements in the DOM that exceed a specified width
This file contains hidden or 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
// Requires jQuery | |
// Specify a max width. This will return any elements in the DOM on the current page | |
// with a width greater than that width. Useful when debugging what element is | |
// screwing up your fluid layout | |
// NOT PRODUCTION CODE - A QUICK 'N DIRTY UTILITY TO SAVE SOME TIME DEBUGGING! | |
var maxWidth = 400; | |
jQuery("*").filter(function () { | |
if (jQuery(this).width() > maxWidth){ | |
console.log(this.nodeName + ' id: ' + this.id + ' class: ' + this.className + ' >>> WIDTH: ' + jQuery(this).width() + 'px'); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment