jQuery(document).ready(function() {
jQuery('#sample_slider').owlCarousel({
responsive:{
0:{ items:1 },
480:{ items:2 },
768:{ items:3 },
980:{ items:4 },
1200:{ items:4 },
1500:{ items:4 }
},
autoplay : true,
autoplayTimeout : 4000,
autoplayHoverPause : true,
smartSpeed : 300,
fluidSpeed : 300,
autoplaySpeed : 300,
navSpeed : 300,
dotsSpeed : 300,
loop : true,
nav : true,
navText : ['Previous','Next'],
dots : true,
responsiveRefreshRate : 200,
slideBy : 1,
mergeFit : true,
autoHeight : false,
mouseDrag : true,
touchDrag : true
});
jQuery('#sample_slider').css('visibility', 'visible');
sa_resize_sample_slider();
window.addEventListener('resize', sa_resize_sample_slider);
function sa_resize_sample_slider() {
var min_height = '50';
var win_width = jQuery(window).width();
var slider_width = jQuery('#sample_slider').width();
if (win_width < 480) {
var slide_width = slider_width / 1;
} else if (win_width < 768) {
var slide_width = slider_width / 2;
} else if (win_width < 980) {
var slide_width = slider_width / 3;
} else if (win_width < 1200) {
var slide_width = slider_width / 4;
} else if (win_width < 1500) {
var slide_width = slider_width / 4;
} else {
var slide_width = slider_width / 4;
}
slide_width = Math.round(slide_width);
var slide_height = '0';
if (min_height == 'aspect43') {
slide_height = (slide_width / 4) * 3; slide_height = Math.round(slide_height);
} else if (min_height == 'aspect169') {
slide_height = (slide_width / 16) * 9; slide_height = Math.round(slide_height);
} else {
slide_height = (slide_width / 100) * min_height; slide_height = Math.round(slide_height);
}
jQuery('#sample_slider .owl-item .sa_hover_container').css('min-height', slide_height+'px');
}
var owl_goto = jQuery('#sample_slider');
jQuery('.sample_slider_goto1').click(function(event){
owl_goto.trigger('to.owl.carousel', 0);
});
jQuery('.sample_slider_goto2').click(function(event){
owl_goto.trigger('to.owl.carousel', 1);
});
jQuery('.sample_slider_goto3').click(function(event){
owl_goto.trigger('to.owl.carousel', 2);
});
jQuery('.sample_slider_goto4').click(function(event){
owl_goto.trigger('to.owl.carousel', 3);
});
jQuery('.sample_slider_goto5').click(function(event){
owl_goto.trigger('to.owl.carousel', 4);
});
jQuery('.sample_slider_goto6').click(function(event){
owl_goto.trigger('to.owl.carousel', 5);
});
jQuery('.sample_slider_goto7').click(function(event){
owl_goto.trigger('to.owl.carousel', 6);
});
jQuery('.sample_slider_goto8').click(function(event){
owl_goto.trigger('to.owl.carousel', 7);
});
var resize_258 = jQuery('.owl-carousel');
resize_258.on('initialized.owl.carousel', function(e) {
if (typeof(Event) === 'function') {
window.dispatchEvent(new Event('resize'));
} else {
var evt = window.document.createEvent('UIEvents');
evt.initUIEvent('resize', true, false, window, 0);
window.dispatchEvent(evt);
}
});
});