Skip to content

Instantly share code, notes, and snippets.

@agarzola
Created March 8, 2024 15:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save agarzola/e9570bcd5f41e8fc0a61868c226012dd to your computer and use it in GitHub Desktop.
Save agarzola/e9570bcd5f41e8fc0a61868c226012dd to your computer and use it in GitHub Desktop.
Find elements rendered off the right side of the viewport
// Copy the code below, paste it into the browser console, and press enter. It
// will return an array of elements rendered off the right side of the viewport.
Array.from(document.querySelectorAll('*')).reduce((results, element) => {
const rect = element.getBoundingClientRect();
if ((rect.width + rect.left) > window.innerWidth) results.push(element);
return results;
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment