PageSourceSearch

https://www.hollis.com/wp-content/themes/Hollis_2021/js/home-top-picks.js?ver=1789758253

js hollis.com collected 2026-10-02 10:42:52 UTC 1,795 bytes, 78 lines download raw bytes

1/**
2 * Home top picks mobile slick slider.
3 *
4 * @package Hollis_2021
5 */
6
7( function ( $ ) {
8	const breakpoint = 768;
9
10	function getSliderSettings( $controls ) {
11		return {
12			slidesToShow: 1,
13			slidesToScroll: 1,
14			dots: true,
15			arrows: true,
16			draggable: true,
17			swipe: true,
18			swipeToSlide: true,
19			infinite: false,
20			adaptiveHeight: false,
21			appendArrows: $controls,
22			appendDots: $controls,
23			prevArrow:
24				'<button type="button" class="slick-prev home-top-picks__slick-prev" aria-label="Previous product"><span aria-hidden="true">&lsaquo;</span></button>',
25			nextArrow:
26				'<button type="button" class="slick-next home-top-picks__slick-next" aria-label="Next product"><span aria-hidden="true">&rsaquo;</span></button>',
27		};
28	}
29
30	function initSlider( $slider ) {
31		if ( $slider.hasClass( 'slick-initialized' ) || window.innerWidth >= breakpoint ) {
32			return;
33		}
34
35		const $controls = $slider
36			.closest( '.home-top-picks__carousel' )
37			.find( '.home-top-picks__controls' );
38
39		if ( ! $controls.length ) {
40			return;
41		}
42
43		$slider.slick( getSliderSettings( $controls ) );
44	}
45
46	function destroySlider( $slider ) {
47		if ( $slider.hasClass( 'slick-initialized' ) ) {
48			$slider.slick( 'unslick' );
49		}
50	}
51
52	function toggleSliders() {
53		$( '.home-top-picks--mobile-slider .home-top-picks__grid' ).each( function () {
54			const $slider = $( this );
55
56			if ( window.innerWidth < breakpoint ) {
57				initSlider( $slider );
58			} else {
59				destroySlider( $slider );
60			}
61		} );
62	}
63
64	$( function () {
65		if ( ! $( '.home-top-picks--mobile-slider' ).length ) {
66			return;
67		}
68
69		toggleSliders();
70
71		let resizeTimer;
72
73		$( window ).on( 'resize', function () {
74			window.clearTimeout( resizeTimer );
75			resizeTimer = window.setTimeout( toggleSliders, 150 );
76		} );
77	} );
78}( jQuery ) );

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.