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

Question: Trigger animation on page load #21

Closed
love-digital opened this issue Sep 25, 2018 · 4 comments
Closed

Question: Trigger animation on page load #21

love-digital opened this issue Sep 25, 2018 · 4 comments
Labels

Comments

@love-digital
Copy link

I might be missing this in the documentation, but is it possible to trigger the animations once the page loads? Right now I have elements that are being watched by Scroll Out that are already in the viewport when the page loads. I would like them to animate in as if they were moving into the viewport, I hope that makes sense.

I can email you the site if you need to see an example.

@notoriousb1t
Copy link
Contributor

I think if you did initialized data-scroll="out" on the elements, that would get you the transition.
People with JavaScript turned off would never see these elements, so whether that is okay or not depends on your situation.

You might be able to add a class to the html itself and then remove it in the onShown(el) event handler and that might give you a safe way to start the animation on startup.

@love-digital
Copy link
Author

OK, will mess with that. Unrelated, is it possible to have a negative offset without using CSS vars? Let's say I have a sticky have and I want to collapse some elements when I am halfway through the element.

@notoriousb1t
Copy link
Contributor

You can set a threshold when you initialize ScrollOut({ threshold: .8 }) which is the amount visible before it is considered "in". https://scroll-out.github.io/guide.html#configuration

If this is for the navigation on the site. I would recommend looking at the offset property instead. It is important to note that you can initialize ScrollOut more than once to target different things provided you add the targets property instead of relying on data-scroll for the secondary targets.

@notoriousb1t
Copy link
Contributor

Closing due to inactivity. If you have further questions, please comment and reopen this issue. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants