Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Add on:ready event or similar? #53

Open
cliveportman opened this issue Dec 21, 2020 · 2 comments
Open

Add on:ready event or similar? #53

cliveportman opened this issue Dec 21, 2020 · 2 comments

Comments

@cliveportman
Copy link

I'm using the AOS library here: http://michalsnik.github.io/aos/
It's great and generally works well with Svelte. But mixing it with a carousel is giving me some issues, such as AOS's offset calculations being out. What I'd like to do is only initialise AOS when the carousel has built. I'm trying:
$: if (carousel) AOS.init()
But that doesn't help. Could we have an on:ready event or something like that that I can listen for before initialising AOS? I'm sure it would help others.

@antony
Copy link
Member

antony commented Dec 21, 2020

@cliveportman happy for this to be the case if you can provide a PR :)

@kiuKisas
Copy link

To emulate this, I bind my carousel to a variable and wait for it to not be undefined anymore.

<script>
  import Carousel from '@beyonk/svelte-carousel';
let carousel = undefined;
</script>

<div class={carousel === undefined ? 'loading' : 'ready'}></div>
<Carousel bind:this={carousel}>
...
</Carousel>

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

No branches or pull requests

3 participants