PageSourceSearch

https://www.draytonmanor.co.uk/_assets/f52b94b47ec5535605bd538078186489/Javascript/card-slider.js?1784004506

js draytonmanor.co.uk collected 2026-09-24 20:54:04 UTC 2,151 bytes, 58 lines download raw bytes

1/**
2 * Common Card Slider Initializer (Stay & Ticket Tiles)
3 * Handles Owl Carousel initialization with Bootstrap tab synchronization.
4 * Configuration is passed via data attributes.
5 */
6$(document).ready(function () {
7    function initCardSlider($slider) {
8        if ($slider.length && !$slider.hasClass('owl-loaded')) {
9            const data = $slider.data();
10
11            const config = {
12                loop: data.owlLoop === true,
13                margin: parseInt(data.owlMargin) || 20,
14                nav: data.owlNav !== false,
15                dots: data.owlDots !== false,
16                autoplay: data.owlAutoplay === true,
17                lazyLoad: data.owlLazyLoad === true,
18                navText: ['<span aria-label="Previous">‹</span>', '<span aria-label="Next">›</span>'],
19                responsive: {
20                    0: {
21                        items: parseFloat(data.itemsMobile) || 1.2,
22                        nav: data.navMobile === true,
23                        loop: data.loopMobile !== false
24                    },
25                    768: {
26                        items: parseInt(data.itemsTablet) || 2
27                    },
28                    1024: {
29                        items: parseInt(data.itemsDesktop) || 3
30                    }
31                }
32            };
33            $slider.owlCarousel(config);
34        }
35    }
36
37    // Initialize sliders that are currently visible
38    $('.stay-card-slider, .ticket-card-slider').each(function () {
39        var $slider = $(this);
40        var $tabPane = $slider.closest('.tab-pane');
41
42        // If not in a tab or in an active tab, initialize
43        if (!$tabPane.length || $tabPane.hasClass('active')) {
44            initCardSlider($slider);
45        }
46    });
47
48    // Handle Bootstrap tab switching
49    $(document).on('shown.bs.tab', function (e) {
50        var targetId = $(e.target).attr('data-bs-target') || $(e.target).attr('href');
51        if (targetId) {
52            var $slider = $(targetId).find('.stay-card-slider, .ticket-card-slider');
53            if ($slider.length) {
54                initCardSlider($slider);
55            }
56        }
57    });
58});

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.