Open krjo opened 5 years ago
I have a similar issue. Attempting to get ahold of a data-attribute on the first slide of a slideshow, and can't utilize the slides property within the ready event. Moreover, attempting to access the flickity object within the ready event returns with undefined.
What would be the right way to call a method that requires the flickity object to exist immediately after instantiation?
I think I'm experiencing a similar issue here with scrolling to the first slide
https://codepen.io/svsdesign/pen/QWjowZp
Unless I'm misunderstanding the whole point of the ready.flickity function?
In both cases, you can resolve the issue by calling your method after initialization, without the ready function.
$carousel.flickity();
$carousel.flickity('remove',$('.carousel-cell:first-child'));
$carousel.flickity({
prevNextButtons: false,
pageDots: false
});
$carousel.flickity("next");
What's going on When using Flickity as a jQuery plugin - the plugin instance is created as the last part of initialization. Unfortunately, that means you cannot use jQuery plugin methods like .flickity('remove')
within the ready.flickity
event.
I need to remove a certain slide on mobile devices. I'm waiting for Flickity to initalize with the ready.flickity event, then using the remove method, and getting an error that Flickity is not initialized.
Console error:
Test case: https://codepen.io/krjo/pen/zVgaYY