} var sliderWrapper = el.querySelector('.t994__slidecontainer'); sliderWrapper.setAttribute('data-slider-touch', 'yes'); if (event.isFinal) { if (event.velocityX > 0.4) { t994_slide(el, 'left'); } else if (event.velocityX < -0.4) { t994_slide(el, 'right'); } sliderWrapper.setAttribute('data-slider-touch', ''); } });}function t994__hideMobileSlides(activeSlide) { if (!activeSlide) return; var slideWrapper = activeSlide.closest('.t-slds__items-wrapper'); var slides = Array.prototype.slice.call(slideWrapper.querySelectorAll('.t-slds__item:not(.t-slds__item_dummy):not([aria-hidden="true"])')); var slideWidth = activeSlide.querySelector('.t994__item-wrapper').style.width; var maxSlidesViewed = document.documentElement.clientWidth > 960 ? 5 : 3; if (slides.length <= maxSlidesViewed * 2) return; var activeSlideIndex = activeSlide.getAttribute('data-slide-index'); if (!activeSlideIndex) return; // don't use this function if slider hasn't been re-published activeSlideIndex = parseInt(activeSlideIndex, 10); // create array with active slide index var activeIndexList = [activeSlideIndex]; for (var i = 1; i < maxSlidesViewed; i++) { // find two or four (depend on screen width) next slides if (activeSlideIndex + i <= slides.length) { activeIndexList.push(activeSlideIndex + i); } else { activeIndexList.push(i); } // find two or four (depend on screen width) previous slides if (activeSlideIndex - i > 0) { activeIndexList.push(activeSlideIndex - i); } else { activeIndexList.push(slides.length + 1 - i); } } var innactiveClass = 't-slds__item-innactive'; slides.forEach(function (slide) { var isActiveIndexSlide = activeIndexList.some(function (index) { return parseInt(slide.getAttribute('data-slide-index'), 10) === index; }); isActiveIndexSlide ? slide.classList.remove(innactiveClass) : slide.classList.add(innactiveClass); // fix for iPad if (document.documentElement.clientWidth > 960) { slide.style.width = slideWidth && !isActiveIndexSlide ? slideWidth : ''; } });}