Please tell minSlides: 4 how to add a rule in the script below so that when the screen width is minSlides: 4 values minSlides: 4 , and maxSlides: 4 , change to minSlides: 3 , and maxSlides: 3 and if the screen width is 768px, minSlides: 2 , and maxSlides: 2
How to implement this task in the form of a script?
jQuery(document).ready(function(){ jQuery('[id*=mod_ext_bxslider_k2_content]').bxSlider({ mode: 'horizontal', randomStart: false, minSlides: 4, maxSlides: 4, slideWidth: 300, slideMargin: 32, adaptiveHeight: false, adaptiveHeightSpeed: 500, easing: 'easeInOutCubic', speed: 1000, controls: true, auto: true, autoControls: false, pause: 7000, autoDelay: 0, autoHover: true, pager: false, pagerType: 'full', pagerShortSeparator: ' / ' }); }); When I do like this (as indicated below) everything works, but for me it is wrong to duplicate all the values and there should be a more elegant solution.
$(window).on('load resize', function(){if ($(window).width() <= 1200) $('[id*=mod_ext_bxslider_k2_content]').bxSlider({ mode: 'horizontal', randomStart: false, minSlides: 3, maxSlides: 3, slideWidth: 300, slideMargin: 32, adaptiveHeight: false, adaptiveHeightSpeed: 500, easing: 'easeInOutCubic', speed: 1000, controls: true, auto: true, autoControls: false, pause: 7000, autoDelay: 0, autoHover: true, pager: false, pagerType: 'full', pagerShortSeparator: ' / ' }); }); $(window).on('load resize', function(){if ($(window).width() <= 768) $('[id*=mod_ext_bxslider_k2_content]').bxSlider({ mode: 'horizontal', randomStart: false, minSlides: 2, maxSlides: 2, slideWidth: 300, slideMargin: 32, adaptiveHeight: false, adaptiveHeightSpeed: 500, easing: 'easeInOutCubic', speed: 1000, controls: true, auto: true, autoControls: false, pause: 7000, autoDelay: 0, autoHover: true, pager: false, pagerType: 'full', pagerShortSeparator: ' / ' }); });