Answer the question
In order to leave comments, you need to log in
How to make a YouTube carousel?
Good afternoon dear community.
The following problem occurred:
I created a video carousel using the Owl library:
var videoCarousel = $('.video-carousel');
videoCarousel.owlCarousel({
items: 1,
loop: true,
dotsClass: "video-carousel-dots",
video: true,
autoplay:true,
autoplayTimeout:5000,
responsive: {
0: {
items: 1,
stagePadding: 50
},
1200: {
stagePadding: 150
},
1470: {
items: 1,
stagePadding: 270
}
}
});
.video-carousel-item {
box-shadow: 20px 28px 54px 0 rgba(0,0,0,0.24);
overflow: hidden;
opacity: .4;
transition: .4s ease all;
transform: scale(.8);
width: 100%;
cursor: pointer;
}
.active .video-carousel-item {
opacity:1;
transform:scale(1);
width: 100%;
cursor: auto;
}
videoCarousel.on('click', '.owl-item', function(e) {
var carousel = videoCarousel.data('owl.carousel');
e.preventDefault();
carousel.to(carousel.relative($(this).index()));
});
Answer the question
In order to leave comments, you need to log in
In this situation, the following option comes to mind:
Make a transparent plate on the iframe with the video. This will prevent the video from starting on click. And remove this die in the active element.
As for playing only one video, I have no answer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question