Skip to content

Instantly share code, notes, and snippets.

@iqbalrony
Last active July 21, 2019 08:17
Show Gist options
  • Save iqbalrony/baf216d7c58df84a50c1d97fd3c944d3 to your computer and use it in GitHub Desktop.
Save iqbalrony/baf216d7c58df84a50c1d97fd3c944d3 to your computer and use it in GitHub Desktop.
Owl-Carousel2-init
(function ($) {
"use strict";
$.fn.product_slider = function () {
return this.each(function () {
var $self = $(this);
var $settings = $self.data('settings');
$self.owlCarousel2({
items: 4,
loop: true,
dots: false,
autoplay: $settings['autoplay'],
autoplayTimeout: $settings['autoplayspeed'],
autoplayHoverPause: true,
nav: $settings['arrow'],
navText: ['<i class="mdi mdi-chevron-left"></i>', '<i class="mdi mdi-chevron-right"></i>'],
responsive : {
// breakpoint from 0 up
0 : {
items : $settings['item_xs'],
},
// breakpoint from 576 up
576 : {
items : $settings['item_sm'],
},
// breakpoint from 768 up
768 : {
items : $settings['item_md'],
},
// breakpoint from 992 up
992 : {
items : $settings['item_lg'],
},
// breakpoint from 1200 up
1200 : {
items : $settings['item_xl'],
}
}
});
});
};
$(document).ready(function () {
// Slider
setTimeout(function(){
$('.product_slider').product_slider();
}, 10);
});
/*End document ready*/
$(window).on("load", function () {
// Slider
$('.product_slider').product_slider();
}); // End window LODE
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment