There is an owl carousel
in which the stagePadding
property is stagePadding
to make the pieces of elements visible. How to make it so that in addition to the switches next | prev, the carousel also switches when you click on the protrusions of the elements on the right and left, respectively? go through the feedl - you will understand
$('.owl-carousel').owlCarousel({ stagePadding: 100, loop: true, margin: 10, nav: true, autoplay: true, autoplayTimeout: 2000, autoplayHoverPause: true, responsive: { 0: { items: 1 }, 470: { items: 3 }, 768: { items: 4 }, 1199: { items: 5 } } }); $('.owl-carousel').find('.owl-item.active').prev(':not(.active)').css('background-color', 'red'); $('.owl-carousel').find('.owl-item.active').next(':not(.active)').css('background-color', 'red');
.owl-carousel .item { height: 10rem; background: #4DC7A0; padding: 1rem; }
<link href="http://www.owlcarousel.owlgraphic.com/assets/owlcarousel/assets/owl.theme.default.min.css" rel="stylesheet" /> <link href="https://owlcarousel2.imtqy.com/OwlCarousel2/assets/css/docs.theme.min.css" rel="stylesheet" /> <link href="https://owlcarousel2.imtqy.com/OwlCarousel2/assets/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://owlcarousel2.imtqy.com/OwlCarousel2/assets/owlcarousel/owl.carousel.js"></script> <div class="owl-carousel"> <div class="item"> <h4>1</h4> </div> <div class="item"> <h4>2</h4> </div> <div class="item"> <h4>3</h4> </div> <div class="item"> <h4>4</h4> </div> <div class="item"> <h4>5</h4> </div> <div class="item"> <h4>6</h4> </div> <div class="item"> <h4>7</h4> </div> <div class="item"> <h4>8</h4> </div> <div class="item"> <h4>9</h4> </div> <div class="item"> <h4>10</h4> </div> <div class="item"> <h4>11</h4> </div> <div class="item"> <h4>12</h4> </div> </div>