SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function* poking() {
  2.     let els = [...document.querySelectorAll('*')];
  3.     for (let el of els) {
  4.         let rect = el.getBoundingClientRect();
  5.         if (rect.x + rect.width > window.innerWidth) {
  6.             yield el;
  7.         }
  8.     }
  9. };
  10.  
  11. // Usage:
  12. let elements = poking();
  13.  
  14. elements.next().value // First matching element...
  15. elements.next().value // Next matching element...
  16. // and so on, until
  17. elements.next().value // undefined (i.e. finished)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top