(function ($) { $(window).load(function () { var windowWidth = $(window).width(); if (jQuery('.wbm-product-bxslider').length !== 0) { var numberOfVisibleSlides; if (windowWidth <= 480) { numberOfVisibleSlides = 1; } else if (windowWidth <= 1024) { numberOfVisibleSlides = 2; } else { numberOfVisibleSlides = 3; } var sliderNextText = jQuery('').addClass('fas fa-chevron-right').css({'color': '#fff', 'background-color': 'rgb(0 0 0 / 20%)'}); var sliderPrevText = jQuery('').addClass('fas fa-chevron-left').css({'color': '#fff', 'background-color': 'rgb(0 0 0 / 20%)'}); jQuery('.wbm-product-bxslider > ul').bxSlider({ onSliderLoad: function () { jQuery('.bx-wrapper').css('visibility', 'visible'); jQuery('.bx-wrapper').parent('.wbm_banner_random_image').fadeIn('medium'); }, minSlides: numberOfVisibleSlides, maxSlides: numberOfVisibleSlides, moveSlides: 1, controls: true, pager: true, auto: true, adaptiveHeight: true, responsive: true, slideWidth: 2200, slideMargin: 30, nextText: sliderNextText.get(0).outerHTML, prevText: sliderPrevText.get(0).outerHTML }); } if ($('.dswbm-sliders-main').length !== 0) { var sliderNextIcon = $('').addClass('fa fa-angle-right'); var sliderPrevIcon = $('').addClass('fa fa-angle-left'); $('.dswbm-sliders-main').each(function () { let sliderWrap = $(this).find('ul'); let sliderMain = $(this); let sliderNumberLargeDesk = sliderMain.attr('slider-large-desk'); let sliderNumberDesk = sliderMain.attr('slider-desk'); let sliderNumberLaptop = sliderMain.attr('slider-laptop'); let sliderNumberTablet = sliderMain.attr('slider-tablet'); let sliderNumberMobile = sliderMain.attr('slider-mobile'); var numberOfVisibleSlides; if (windowWidth <= 480) { numberOfVisibleSlides = sliderNumberMobile; } else if (windowWidth <= 736) { numberOfVisibleSlides = sliderNumberTablet; } else if (windowWidth <= 980) { numberOfVisibleSlides = sliderNumberLaptop; } else if (windowWidth <= 1280) { numberOfVisibleSlides = sliderNumberDesk; } else { numberOfVisibleSlides = sliderNumberLargeDesk; } let autoPlay = sliderMain.attr('auto-play'); let autoPlaySpeed = sliderMain.attr('auto-play-speed'); let scrollSpeed = sliderMain.attr('scroll-speed'); let pauseOnHover = sliderMain.attr('pause-hover'); let inFiniteLoop = sliderMain.attr('infinite-loop'); let autoHeight = sliderMain.attr('auto-height'); let sliderNav = sliderMain.attr('show-controls'); let sliderPager = sliderMain.attr('show-pager'); let slideSpace = sliderMain.attr('slide-space'); let slidermode = sliderMain.attr('slider-mode'); let sliderLayoutPreset = sliderMain.attr('slider-layout-preset'); var slidermodestatus; if ( 'standard' === slidermode || '' === slidermode ) { slidermodestatus = false; } else { slidermodestatus = true; autoPlay = 'false'; } if( '' === sliderLayoutPreset || undefined === sliderLayoutPreset ) { sliderLayoutPreset = 'slider'; } if( 'slider' === sliderLayoutPreset ){ sliderWrap.find('li.last').removeClass('last'); sliderWrap.bxSlider({ minSlides: numberOfVisibleSlides, maxSlides: numberOfVisibleSlides, moveSlides: 1, controls: sliderNav === 'true' ? true : false, pager: sliderPager === 'true' ? true : false, auto: autoPlay === 'true' ? true : false, pause: parseInt(autoPlaySpeed), speed: parseInt(scrollSpeed), ticker: slidermodestatus, tickerHover: slidermodestatus, useCSS: false, zoomType: "inner", imageCrossfade: true, adaptiveHeight: autoHeight === 'true' ? true : false, autoHover: pauseOnHover === 'true' ? true : false, infiniteLoop: inFiniteLoop === 'true' ? true : false, responsive: true, touchEnabled: false, slideWidth: 2200, slideMargin: parseInt(slideSpace), nextText: sliderNextIcon.get(0).outerHTML, prevText: sliderPrevIcon.get(0).outerHTML }); } }); } }); })(jQuery);