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

Event that can be fired right after Slider initialization #166

Closed
khryshyn opened this issue Mar 3, 2018 · 3 comments
Closed

Event that can be fired right after Slider initialization #166

khryshyn opened this issue Mar 3, 2018 · 3 comments
Labels

Comments

@khryshyn
Copy link

khryshyn commented Mar 3, 2018

Would be nice to have Event that can be fired right after Slider initialization
Current onInit callback invoking to earlier. At this stage, we can't get the information regarding the current carousel state, items, events, etc...

version: 2.6

@ganlanyuan
Copy link
Owner

Hey, I explained why initialized event won't work here.
BTY, the onInit function will be fired right after the initialization.

if (typeof onInit === 'function') { onInit(info()); }

@maschmiede
Copy link

maschmiede commented Nov 30, 2022

I jumped over this ticket because I've needed that as well. Here is what I've done:

let sliderPromise = new Promise(function(sliderResolve) {
    const slider = tns({
        container: '.slider',
        autoplay: true,
        // ...
    });
    sliderResolve(slider.getInfo().container);
});

sliderPromise.then(function(sliderContainer){
    // .. code after the slider has been built up
});

@feodoraxis
Copy link

feodoraxis commented Dec 15, 2023

I was able to resolve it this way:

const slider = tns({
  container: "#slider",
  onInit: (e) => {
    //Your code after init
  },
  //...
})

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

4 participants