Comments (8)
Glad to hear!
from vue-scroll-reveal.
I created a test project (tserkov/sr-test) to try to reproduce, but I couldn't; navigating between routes triggers the scroll-reveal animation. Could you provide me with some code where the elements aren't appearing as expected?
from vue-scroll-reveal.
I just re-read your issue, and it actually sounds like the animation is triggering, but it's triggering simultaneously with vue-router's <transition>
. If that's the case, you could try adding a delay, like this: v-scroll-reveal="{ delay: 250 }"
or however long your router transition is in ms.
from vue-scroll-reveal.
Yeah, it is exactly what I try to say... I'm not sure if the reveal is triggering along the vue-router transition, because the elements doesn't show up.
I thought the same solution, set a delay. But it's a liitle tricky. First of all, if I have a few transitions, with different delay, I have to add 250ms to every transition. And even more tricky, if I set "reset" to these transition, when I scroll up the transition will excecute 250ms later every time, when I only need that delay when the page loads...
It would be better, if it's possible, that the animations start after any parent transition, especially when there are a route-view transition...
Hope you can understand, i'm not english speaker...
from vue-scroll-reveal.
I only need that delay when the page loads
@cdmoro that is possible with options.useDelay
set to 'onload'
from vue-scroll-reveal.
@jlmakes thanks but I need to use delays, what I don't want to do is have to add 250ms in every transition because of a parent transition.
Par example, I have a parent transition (router-view transition), witch finish in 250ms and, in the other hand, I have a few sequenced animations with v-scroll-reveal, each one with differents delay (first: 50, second: 100, third: 150...). If I use the @tserkov solution, I'm forced to add a delay of 250 in all of my animations, so, the first animation will be 250 + 50, the second 100 + 250, and the third 150 + 250... witch is a lot of time in my opinion...
And if I want to combine with the "reset" property, every time I scroll up, the first transition will appear in 300ms (250 + 50) instead 50ms...
I think that a better solution is that the directive knows when a parent transition finish... I have no idea if it's possible or not
from vue-scroll-reveal.
I've just pushed an update (1.0.5) that makes the options reactive.
So, once you've updated, you should be able to do something like the following:
<template>
<section v-scroll-reveal.reset="scrollRevealOptions">
...
</section>
</template>
<script>
export default {
data() {
return {
scrollRevealOptions: {
delay: 250,
},
};
},
mounted() {
setTimeout(() => {
this.scrollRevealOptions.delay = 0;
}, 250);
},
};
</script>
This has a component default of 250ms delay (change to match your router transition duration), then after that same amount of time sets the delay to 0, so further scrolling won't have that delay. mounted()
will re-fire after each router transition. (I updated tserkov/sr-test to demonstrate this.
If you want tiered delays, you can do this:
<template>
<section v-scroll-reveal.reset="{ delay: scrollRevealBaseDelay }">
...
</section>
<section v-scroll-reveal.reset="{ delay: scrollRevealBaseDelay * 2 }">
...
</section>
</template>
<script>
export default {
data() {
return {
scrollRevealBaseDelay: 250,
};
},
mounted() {
setTimeout(() => {
this.scrollRevealBaseDelay = 0;
}, 250);
},
};
</script>
from vue-scroll-reveal.
I thought that the options was already reactive, in fact, I use it like your first example. BTW, your second example is a nice workaround for what I need to do. Thanks! I think the ticket is closed 😃
from vue-scroll-reveal.
Related Issues (20)
- Elements leaving viewport resets to initial position and opacity HOT 3
- How do we achieve "sr.clean('target')" or sr.destroy(') with vue-scroll-reveal? HOT 1
- Vue.$sr returns $sr is undefined in browser HOT 6
- Not working on Mobile Devices HOT 2
- Sometimes not working HOT 2
- First load not working
- Interval don't works with Nuxt HOT 4
- scroll-reveal and pre-reendering HOT 3
- When using this plugin, if it is a full-screen large picture, a white screen will appear. HOT 1
- support typescript??? HOT 1
- Elements do not reveal after page has loaded for a second time on gridsome HOT 1
- Uncaught TypeError: Cannot read property 'bounds' of undefined HOT 1
- Elements appear only on top on the page.
- Cleanup: true not working HOT 1
- vue-scroll-reveal not working HOT 2
- Dynamically set scroll reveal on certain elements in a loop HOT 1
- Nuxt 3 directive error HOT 14
- createScrollRevealDirective is not a function HOT 2
- Cannot read properties of undefined (reading 'install')
- Nuxt 3 `Failed to resolve directive` error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-scroll-reveal.