Created
May 26, 2014 12:04
-
-
Save jeremypetrequin/4f2f1690c40a4e85b5c7 to your computer and use it in GitHub Desktop.
Find what f***** DOM element break your responsive by adding a horz scrollbar
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
//put this in your console, and see the red elements | |
var breakpoint = 320; | |
$('*').each(function() { | |
($t = $(this)).outerWidth() + $t.offset().left > breakpoint && console.log($t.css('background', 'red')); | |
}); |
let breakpoint = 320;
document.querySelectorAll('*').forEach(function($el) {
if($el.getBoundingClientRect().width + $el.getBoundingClientRect().left > breakpoint) {
$el.style.background = 'red'
console.log($el);
}
});
With console.log working ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// Without jquery
var breakpoint = 320;
document.querySelectorAll('*').forEach(function(el) {
($t = el.getBoundingClientRect().width + el.getBoundingClientRect().left > breakpoint && console.log(el.style.background = 'red'));
});