Skip to content

Instantly share code, notes, and snippets.

View ponsfrilus's full-sized avatar
🤖
Ideas are easy. Execution is everything.

Nicolas Borboën ponsfrilus

🤖
Ideas are easy. Execution is everything.
View GitHub Profile
@headquarters
headquarters / find-oversized-element.js
Last active December 28, 2018 13:58
Find the offending element causing a horizontal scrollbar at any screen width (requires jQuery).
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);
}
});