-
-
Save newhope/cb3f8c7c7c098d24f99d5d680a54ff35 to your computer and use it in GitHub Desktop.
Find the offending element causing a horizontal scrollbar at any screen width (requires jQuery).
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
var screenWidth = window.innerWidth; | |
var visibleElements = jQuery(":visible"); | |
visibleElements.each(function(){ | |
var $this = jQuery(this); | |
if($this.width() > screenWidth){ | |
$this.css("border", "1px solid green"); | |
console.log("Screen width is " + screenWidth + " and the following element is " + $this.width(), $this); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment