I have included owl carousel inside a section tag in JSP . My requirement is that owl carousel should autoplay only when the user scroll to that section. And it should pause when user scrolls down to another section and continue to autoplay when user scrolls up to that containing section. Tried several methods , but not working. If anyone could help me with it would be great.
Asked
Active
Viewed 417 times
0
-
https://stackoverflow.com/questions/21561480/trigger-event-when-user-scroll-to-specific-element-with-jquery It may help you. – Sumesh TG Oct 15 '18 at 13:53
-
Refer http://jsfiddle.net/n4pdx/ – Sumesh TG Oct 15 '18 at 13:54
1 Answers
1
normally this thing not possible by scroll down, but for this thing, you can add autoplay when carousel visible but it is working only on mouseover
var owl = $('.owl-carousel');
owl.owlCarousel({
items: 1,
loop: true
});
$('.section').on("mouseenter", function(e) {
owl.trigger('owl.play', 2000);
})

Krutarth Patel
- 11
- 2