Created
March 11, 2014 18:45
-
-
Save kazzkiq/9492350 to your computer and use it in GitHub Desktop.
Find which elements are exploding your window size (creating scrollbars)
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
function scanForScrollers(el) { | |
var i = [], | |
t, x, y, w, h, | |
ww = $(window).width(), | |
wh = $(window).height(); | |
el.each(function (index) { | |
t = $(this); | |
x = t[0].offsetLeft; | |
y = t[0].offsetTop; | |
w = t.outerWidth(); | |
h = t.outerHeight(); | |
if (w > ww || +x + w > ww || h > wh || +y + h > wh) { | |
i.push(t[0]); | |
} | |
}); | |
return i; | |
} | |
//how to use: | |
var scrollers = scanForScrollers($('body *')); | |
$(scrollers).addClass('iFoundYou!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Obvious tip: It needs jQuery to work.