Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I add class or animation for elements on scroll #66

Closed
gigholll opened this issue May 7, 2017 · 3 comments
Closed

How can I add class or animation for elements on scroll #66

gigholll opened this issue May 7, 2017 · 3 comments

Comments

@gigholll
Copy link

gigholll commented May 7, 2017

Hi, your plugin is awesome!
I am designer, which interested in js , and I have a problem)

In other project I use for this onScreen.js plugin, but it doesn't work. How can I add class or animation for elements on scroll, when they reach viewport?

@baptistebriel
Copy link
Owner

Hi @gigholll! Have you tried running the demos in your browser? There's a few ones where we're adding styles and/or classes to the elements when they reach the viewport.

@gigholll
Copy link
Author

tnks for fast answer @baptistebriel. I found "key: 'inViewport'" in the code. But i use fix for onScreen.js, that refresh viewport.
var onScreenFix = setInterval(function() {
$(window).resize();
}, 500);

@baptistebriel
Copy link
Owner

I wouldn't recommend that fix; all your resize logic might be called when the user is scrolling. This could lead to perfs issues if there's big calculations / dom manipulations done on resize..

Repository owner deleted a comment Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants