-
I created a simple x-data function that does a simple count up animation (eg. start at 0 and count to 100).
countUp.js contains:
This works perfectly fine with x-data
Is there any way to use x-intersect to trigger running this when in view? Maybe I'm missing something or maybe it just isn't possible with x-intersect. Thanks for any help you could provide. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You can add a control variable initialised to false. On x-intersect:enter you set it to true, on x-intersect:leave you set it back to false. Inside your setInterval at the very top, if the variable is false, you just return early without doing anything |
Beta Was this translation helpful? Give feedback.
You can add a control variable initialised to false. On x-intersect:enter you set it to true, on x-intersect:leave you set it back to false. Inside your setInterval at the very top, if the variable is false, you just return early without doing anything