Skip to content

Instantly share code, notes, and snippets.

@dstevensio
Created October 17, 2014 21:38
Show Gist options
  • Save dstevensio/42c9cf7f6b26c6ef55ea to your computer and use it in GitHub Desktop.
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
// 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