1import { tns } from 'tiny-slider'; 2 3export default function slider() { 4 const containers = Array.from(document.querySelectorAll('.slider')); 5 if (containers.length) { 6 containers.forEach((container) => { 7 const { 8 items, mode, autoplay, navAsThumbnails, 9 navContainer, responsive, hideNav, 10 prevButton, nextButton, controls, startStopId, 11 } = container.dataset; 12 13 let respOpts = {}; 14 15 if (responsive) { 16 respOpts = { 17 750: { 18 items: 4, 19 }, 20 21 600: { 22 items: 3, 23 }, 24 }; 25 } 26 27 tns({ 28 container, 29 items, 30 mode, 31 autoplay, 32 navAsThumbnails, 33 navContainer, 34 nav: !hideNav, 35 responsive: respOpts, 36 controls, 37 autoplayPosition: 'bottom', 38 autoplayText: ["<span ><i class='fa-solid fa-play'></i></span>", "<span><i class='fa-solid fa-pause'></i></span>"], 39 mouseDrag: true, 40 touch: true, 41 navPosition: 'bottom', 42 slideBy: 'page', 43 lazyload: false, 44 autoplayButtonOutput: false, 45 autoplayButton: startStopId, 46 autoplayTimeout: 5000, 47 autoplayHoverPause: true, 48 prevButton, 49 nextButton, 50 }); 51 52 // Allow keyboard users to tab through controls 53 document.querySelectorAll('.move-control').forEach((btn) => { btn.removeAttribute('tabindex'); }); 54 55 // Check element has rendered after intialising tns and hide from screen readers 56 const sliderCounter = document.querySelector('div.tns-liveregion.tns-visually-hidden'); 57 if (sliderCounter) { sliderCounter.ariaHidden = true; } 58 }); 59 } 60 61 const restyles = Array.from(document.querySelectorAll('[data-slider-restyle]')); 62 63 restyles.forEach((restyle) => { 64 restyle.removeAttribute('style'); 65 }); 66}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.