I have 3 divs that activate slide toggle when I click on them. And inside every div there is owl carousel slider.
If I trigger one div the slider shows, but when I click other div slider doesn't show unless I resize the window.
How can I trigger refresh on slide toggle for the slider in every div?
I tried with this on slide toggle but it doesn't work:
$('.owl-slider').trigger('refresh.owl.carousel');
You can initialize the carousel and store it in a variable and using that variable you can refresh the owl carousel. like the below example. var $owlCarousel = $('. owl-carousel').
Owl Carousel hasn't been updated in 3 years and is officially deprecated by its maintainers.
When you initialize the carousel store the carousel object in a variable for future use. var $owl = $("#owl-demo"). owlCarousel({ navigation: true, // Show next and prev buttons slideSpeed: 300, paginationSpeed: 400, items: 1, itemsDesktop: false, itemsDesktopSmall: false, itemsTablet: false, itemsMobile: false, });
owl. carousel', [$(this). index(), 300]); }); That should be all you need to get custom dots up and going with Owl Carousel 2.
You trigger with a class. You can try with a variable:
var $owl = $('.owl-carousel').owlCarousel({
items: 1,
loop:true
});
$owl.trigger('refresh.owl.carousel');
if .trigger('refresh.owl.carousel');
didn't work with you, you can use
window.dispatchEvent(new Event('resize'));
which will make the carousel refresh automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With