-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
More flexible viewport setting #26
Comments
It's possible using an absolute
This would animate the element for a distance of 25vh. |
I should have specified that I meant that it reaches 25% from the bottom of the viewport, not document. Absolute values won't work for me. I managed to work around that using Sorry, I don't feel that good with javascript to to dare and offer a PR, but from what I've seen adding something like:
to If you'll even find time to look into this that would be great, thanks! |
Recommended solutionA custom anchor can be used to animate .anchor {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 75vh;
pointer-events: none;
} basicScroll.create({
elem: document.querySelector('.anchor'),
from: 'top-top',
to: 'bottom-top',
direct: document.querySelector('.elem'),
props: {
'--opacity': {
from: .01,
to: .99
}
}
}) This will change See direct mode for more details. |
It would be great to be able to define viewport values in vh units (or percentage/fraction of window height) ex:
from: 'top-bottom', to: 'top-75vh'
. Use case example: to reveal elements as they scroll into view (with opacity and a bit of movement) and have the transition end as the element's top reaches 25% from the bottom. I could usecalc
and let the opacity go above 1 usingtop-middle
, but the movement would continue.The text was updated successfully, but these errors were encountered: