Share Posted August 4, 2016 Great demo Shaun! Once I have that, I will animate better than Looney Tunes and I will do it all with GSAP. I will be heralded and win many prizes and do GSAP proud. Love it! Here's your guide to not using jQuery... http://youmightnotneedjquery.com For element visibility, you can use element.getBoundingClientRect(). It returns the coordinates of the element relative to the screen, even if it's transformed. var rect = myElement.getBoundingClientRect(); var vh = window.innerHeight; if (rect.top >= 0 && rect.bottom <= vh) { // Fully visible } if (rect.top + rect.height >= 0 && rect.bottom - rect.height <= vh) { // Partially visible } Listening for "touchmove" and "scroll" events should fix the iOS problem. You need to be careful about how you do scroll events as they can be a performance killer. I would recommend using TweenLite.ticker to run the scroll event updates as it will throttle the calls. Checking the visibility on 600 elements. See the Pen 0d4742d2200d028ed42297cb874af2b5?editors=0010 by osublake (@osublake) on CodePen 5 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now