//*JS way for setting height: 100vh to slides' height /*const $slides = $(".owl-carousel .owl-slide"); $slides.css("height", $(window).height()); $(window).resize(() => { $slides.css("height", $(window).height()); });*/ function ProductSlider() { if($('.bbb_slider').length) { var trendsSlider = $('.bbb_slider'); trendsSlider.owlCarousel( { autoHeight: true, autoplay:true, autoplayTimeout:2000, autoplayHoverPause:true, items: 1, loop: true, center: false, rewind: false, dots:false, responsive: { 0:{items:1}, 320:{items:1}, 481:{items:2}, 769:{items:2}, 1025:{items:4} }, mouseDrag: true, touchDrag: true, pullDrag: true, freeDrag: false, margin: 0, stagePadding: 0, merge: false, mergeFit: false, autoWidth: false, autoHeight: false, startPosition: 0, smartSpeed: 1000, responsiveRefreshRate: 200, fallbackEasing: 'swing', lazyLoad: true }); trendsSlider.on('click', '.bbb_fav', function (ev) { $(ev.target).toggleClass('active'); }); if($('.bbb_prev').length) { var prev = $('.bbb_prev'); prev.on('click', function() { trendsSlider.trigger('prev.owl.carousel'); }); } if($('.bbb_next').length) { var next = $('.bbb_next'); next.on('click', function() { trendsSlider.trigger('next.owl.carousel'); }); } } } //product owl end function SliderScript() { $(".bb2").on("initialized.owl.carousel", () => { setTimeout(() => { $(".owl-item.active .owl-slide-animated").addClass("is-transitioned"); $("section").show(); }, 200); }); const $owlCarousel = $(".bb2").owlCarousel({ items: 1, loop: true, autoHeight:false, nav: true, loop: true, lazyLoad:true, center: false, mouseDrag: true, touchDrag: true, pullDrag: true, freeDrag: false, stagePadding: 0, startPosition: 0, smartSpeed: 600, //responsiveRefreshRate: 200, fallbackEasing: 'swing', //lazyLoad: true, navText: [ '', '' /* icons from https://iconmonstr.com */] }); $owlCarousel.on("changed.owl.carousel", e => { $(".owl-slide-animated").removeClass("is-transitioned"); const $currentOwlItem = $(".owl-item").eq(e.item.index); $currentOwlItem.find(".owl-slide-animated").addClass("is-transitioned"); const $target = $currentOwlItem.find(".owl-slide-text"); }); } /*if there isn't content underneath the carousel*/ //$owlCarousel.trigger("refresh.owl.carousel"); SliderScript(); ProductSlider();