PageSourceSearch

https://funlondontours.com/wp-content/plugins/orqa-tours-display/assets/js/tours-carousel.js?ver=1.2.9

js funlondontours.com collected 2026-10-02 14:04:52 UTC 2,360 bytes, 78 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2  document.querySelectorAll('[data-orqa-carousel]').forEach(function (carousel) {
3    const track = carousel.querySelector('.orqa-carousel__track');
4    const slides = Array.from(carousel.querySelectorAll('.orqa-carousel__slide'));
5    const prevBtn = carousel.querySelector('[data-dir="prev"]');
6    const nextBtn = carousel.querySelector('[data-dir="next"]');
7    const dotsWrap = carousel.querySelector('[data-orqa-dots]');
8
9    if (!track || slides.length === 0) return;
10
11    let currentIndex = 0;
12
13    function getSlidesPerView() {
14      if (window.innerWidth <= 767) return 1;
15      if (window.innerWidth <= 1100) return 2;
16      return 3;
17    }
18
19    function getMaxIndex() {
20      return Math.max(0, slides.length - getSlidesPerView());
21    }
22
23    function buildDots() {
24      if (!dotsWrap) return;
25      dotsWrap.innerHTML = '';
26      for (let i = 0; i <= getMaxIndex(); i++) {
27        const dot = document.createElement('button');
28        dot.type = 'button';
29        dot.className = 'orqa-carousel__dot';
30        dot.setAttribute('aria-label', 'Go to slide ' + (i + 1));
31        dot.addEventListener('click', function () {
32          currentIndex = i;
33          update();
34        });
35        dotsWrap.appendChild(dot);
36      }
37    }
38
39    function update() {
40      const maxIndex = getMaxIndex();
41      if (currentIndex > maxIndex) currentIndex = maxIndex;
42      if (currentIndex < 0) currentIndex = 0;
43
44      const slideWidth = slides[0].getBoundingClientRect().width;
45      track.style.transform = 'translateX(-' + (slideWidth * currentIndex) + 'px)';
46
47      if (prevBtn) prevBtn.disabled = currentIndex === 0;
48      if (nextBtn) nextBtn.disabled = currentIndex >= maxIndex;
49
50      if (dotsWrap) {
51        dotsWrap.querySelectorAll('.orqa-carousel__dot').forEach(function (dot, index) {
52          dot.classList.toggle('is-active', index === currentIndex);
53        });
54      }
55    }
56
57    if (prevBtn) {
58      prevBtn.addEventListener('click', function () {
59        currentIndex -= 1;
60        update();
61      });
62    }
63
64    if (nextBtn) {
65      nextBtn.addEventListener('click', function () {
66        currentIndex += 1;
67        update();
68      });
69    }
70
71    buildDots();
72    update();
73    window.addEventListener('resize', function () {
74      buildDots();
75      update();
76    });
77  });
78});

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.