Skip to content

Instantly share code, notes, and snippets.

View duonghaipham's full-sized avatar

Duong Hai Pham duonghaipham

View GitHub Profile
@cuth
cuth / debug-scroll.md
Last active June 4, 2024 12:53
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
 if (b.right > w || b.left < 0) {