1$(function () { 2 $(".slider").each(function () { 3 const data = $(this).data("sliderdata"); 4 console.log(data); 5 console.log($("#slider-next-" + data.id)); 6 console.log($("#slider-prev-" + data.id)); 7 8 var $slider = $(this); 9 10 // The legacy variant reproduces the SmartPress-3 slider, which was unslider: 11 // it had dots, and it advanced a whole slide at a time rather than one post. 12 // slidesToScroll drives both - slick derives the dot count from it, so 13 // leaving it at the default 1 gives a dot per post (12) where v3 showed one 14 // per slide (3). Gated on the class so sliders on natively-built v4 sites 15 // keep the arrows-only behaviour they were designed with. 16 var legacy = $slider.hasClass("posts-slider-legacy"); 17 18 $slider.slick({ 19 arrows: true, 20 dots: legacy, 21 slidesToShow: data.posts_per_slide, 22 slidesToScroll: legacy ? Number(data.posts_per_slide) : 1, 23 nextArrow: $("#slider-next-" + data.id), 24 prevArrow: $("#slider-prev-" + data.id), 25 }); 26 27 // Function to ensure elements with aria-hidden="true" don't have tabindex 28 function updateTabIndex() { 29 // Find all slides 30 var $slides = $slider.find('.slider-post'); 31 32 // Check each slide 33 $slides.each(function() { 34 // If the slide has aria-hidden="true", remove any tabindex 35 if ($(this).attr('aria-hidden') === 'true') { 36 $(this).removeAttr('tabindex'); 37 // Also remove tabindex from any focusable elements inside 38 $(this).find('a, button, [tabindex]').removeAttr('tabindex'); 39 } 40 }); 41 } 42 43 // Update on initialization 44 updateTabIndex(); 45 46 // Update when slides change 47 $slider.on('afterChange', function() { 48 updateTabIndex(); 49 }); 50 51 // Update on window resize 52 $(window).on('resize', function() { 53 updateTabIndex(); 54 }); 55 }); 56});
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.