Last active
December 23, 2016 15:42
-
-
Save travhimself/beb6da78fab760fab8010dbdeeb602fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // search for a DOM element every rendering frame until it exists | |
| // | |
| // borrowed from: | |
| // https://swizec.com/blog/how-to-properly-wait-for-dom-elements-to-show-up-in-modern-browsers/swizec/6663 | |
| function lookforelement() { | |
| if ( !$('.element').size() ) { | |
| window.requestAnimationFrame(lookforelement); | |
| } else { | |
| console.log('found element'); | |
| } | |
| }; | |
| lookforelement(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment