112 lines
2.1 KiB
JavaScript
112 lines
2.1 KiB
JavaScript
|
// npm package: owl.carousel
|
||
|
// github link: https://github.com/OwlCarousel2/OwlCarousel2
|
||
|
|
||
|
$(function() {
|
||
|
'use strict';
|
||
|
|
||
|
if($('.owl-basic').length) {
|
||
|
$('.owl-basic').owlCarousel({
|
||
|
loop:true,
|
||
|
margin:10,
|
||
|
rtl: checkRTL(),
|
||
|
nav:false,
|
||
|
responsive:{
|
||
|
0:{
|
||
|
items:2
|
||
|
},
|
||
|
600:{
|
||
|
items:3
|
||
|
},
|
||
|
1000:{
|
||
|
items:4
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if($('.owl-auto-play').length) {
|
||
|
$('.owl-auto-play').owlCarousel({
|
||
|
items:4,
|
||
|
loop:true,
|
||
|
margin:10,
|
||
|
rtl: checkRTL(),
|
||
|
autoplay:true,
|
||
|
autoplayTimeout:1000,
|
||
|
autoplayHoverPause:true,
|
||
|
responsive:{
|
||
|
0:{
|
||
|
items:2
|
||
|
},
|
||
|
600:{
|
||
|
items:3
|
||
|
},
|
||
|
1000:{
|
||
|
items:4
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if($('.owl-fadeout').length) {
|
||
|
$('.owl-fadeout').owlCarousel({
|
||
|
animateOut: 'fadeOut',
|
||
|
rtl: checkRTL(),
|
||
|
items:1,
|
||
|
margin:30,
|
||
|
stagePadding:30,
|
||
|
smartSpeed:450
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if($('.owl-animate-css').length) {
|
||
|
$('.owl-animate-css').owlCarousel({
|
||
|
animateOut: 'animate__animated animate__slideOutDown',
|
||
|
animateIn: 'animate__animated animate__flipInX',
|
||
|
items:1,
|
||
|
rtl: checkRTL(),
|
||
|
margin:30,
|
||
|
stagePadding:30,
|
||
|
smartSpeed:450
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if($('.owl-mouse-wheel').length) {
|
||
|
var owl = $('.owl-mouse-wheel');
|
||
|
owl.owlCarousel({
|
||
|
loop:true,
|
||
|
nav:false,
|
||
|
rtl: checkRTL(),
|
||
|
margin:10,
|
||
|
responsive:{
|
||
|
0:{
|
||
|
items:2
|
||
|
},
|
||
|
600:{
|
||
|
items:3
|
||
|
},
|
||
|
960:{
|
||
|
items:3
|
||
|
},
|
||
|
1200:{
|
||
|
items:4
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
owl.on('mousewheel', '.owl-stage', function (e) {
|
||
|
if (e.deltaY>0) {
|
||
|
owl.trigger('next.owl');
|
||
|
} else {
|
||
|
owl.trigger('prev.owl');
|
||
|
}
|
||
|
e.preventDefault();
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
function checkRTL() {
|
||
|
if (document.querySelector('html')?.getAttribute('dir') === 'rtl') {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
});
|