shreshthmohan / next-blog

next-blog-mu-three.vercel.app
2 stars 0 forks source link

Check if an element is going out of window width #95

Open shreshthmohan opened 1 year ago

shreshthmohan commented 1 year ago

url: https://shreshth.dev/blog/check-if-an-element-is-going-out-of-window-width

You can simply paste this in the developer console.

const all  = document.querySelectorAll('*')
all.forEach(el => {
    if (el.clientWidth + el.getBoundingClientRect().x > window.innerWidth) {
        console.log(el)
    }
})