PageSourceSearch

https://skiptown.io/wp-content/themes/hello-theme-child-master/assets/custom.js?ver=1790664012

js skiptown.io collected 2026-09-29 06:52:38 UTC 11,013 bytes, 354 lines download raw bytes

1jQuery(document).ready(function($) {
2  var $loopContainer = $('.services-loop');
3  if (!$loopContainer.length) return;
4
5  var count = $loopContainer.find('.e-loop-item').length;
6  $loopContainer.addClass('post-count-' + count);
7});
8
9var $ = jQuery;
10
11// Header Scroll Hide/Show
12document.addEventListener('DOMContentLoaded', function() {
13  // Run only on desktop devices (width >= 1025px)
14  if (window.innerWidth < 1025) return;
15
16  let lastScrollTop = 0;
17  const header = document.querySelector('.main-header');
18  if (!header) return;
19
20  window.addEventListener('scroll', function() {
21    const currentScrollTop = window.pageYOffset || document.documentElement.scrollTop;
22
23    if (currentScrollTop <= 0) {
24      header.classList.remove('scrolling-up', 'scrolling-down');
25    } else if (currentScrollTop < lastScrollTop) {
26      header.classList.add('scrolling-up');
27      header.classList.remove('scrolling-down');
28    } else if (currentScrollTop > lastScrollTop) {
29      header.classList.remove('scrolling-up');
30      header.classList.add('scrolling-down');
31    }
32
33    lastScrollTop = currentScrollTop <= 0 ? 0 : currentScrollTop;
34  });
35});
36
37
38
39// Header Scroll Hide/Show (after scrolling 100vh)
40// document.addEventListener('DOMContentLoaded', function() {
41  
42//   if (window.innerWidth < 1025) return;
43
44//   let lastScrollTop = 0;
45//   const header = document.querySelector('.main-header');
46//   if (!header) return;
47
48//   const triggerHeight = 200;
49
50//   window.addEventListener('scroll', function() {
51//     const currentScrollTop = window.pageYOffset || document.documentElement.scrollTop;
52
53    
54//     if (currentScrollTop < triggerHeight) {
55//       header.classList.remove('scrolling-up', 'scrolling-down');
56//       return;
57//     }
58
59//     if (currentScrollTop < lastScrollTop) {
60     
61//       header.classList.add('scrolling-up');
62//       header.classList.remove('scrolling-down');
63//     } else if (currentScrollTop > lastScrollTop) {
64      
65//       header.classList.remove('scrolling-up');
66//       header.classList.add('scrolling-down');
67//     }
68
69//     lastScrollTop = currentScrollTop <= 0 ? 0 : currentScrollTop;
70//   });
71// });
72
73
74
75
76//Testimonial Slider
77$(document).ready(function () {
78    function setOddEvenClasses() {
79        $('.testimonial-slide-item').removeClass('odd even');
80
81        $('.testimonial-slide-item').each(function () {
82            var slideIndex = parseInt($(this).attr('data-slick-index'), 10);
83            if (isNaN(slideIndex)) return;
84
85            if ((slideIndex + 1) % 2 === 0) {
86                $(this).addClass('even');
87            } else {
88                $(this).addClass('odd');
89            }
90        });
91    }
92
93    // Init slick
94    $('.testimonial-slider').on('init', function () {
95        setOddEvenClasses();
96    });
97
98    $('.testimonial-slider').slick({
99        dots: true,
100        infinite: true,
101        speed: 500,
102        slidesToShow: 3,
103        slidesToScroll: 1,
104        centerMode: true,
105        centerPadding: '150px',
106        arrows: false,
107        responsive: [
108            {
109                breakpoint: 1300,
110                settings: {
111                    slidesToShow: 3,
112                    slidesToScroll: 1,
113                    infinite: true,
114                    centerPadding: '40px',
115                    dots: true
116                }
117            },
118                        {
119                breakpoint: 900,
120                settings: {
121                    slidesToShow: 2,
122                    slidesToScroll: 1,
123                    centerPadding: '60px',
124                }
125            },
126            {
127                breakpoint: 640,
128                settings: {
129                    slidesToShow: 1,
130                    slidesToScroll: 1,
131                    centerPadding: '40px',
132                }
133            }
134        ]
135    });
136
137    // Odd/Even update
138    $('.testimonial-slider').on('afterChange', function () {
139        setOddEvenClasses();
140    });
141
142    // --------------------------
143    // Video Handling
144    // --------------------------
145    $(".testimonial_video-wrapper").each(function () {
146        var $wrapper = $(this);
147        var $video = $wrapper.find(".testimonial-video");
148        var $playBtn = $wrapper.find(".play-btn");
149
150        // Manual play/pause on button
151        $playBtn.on("click", function () {
152            if ($video[0].paused) {
153                $video[0].play();
154                $playBtn.addClass("is-playing");
155            } else {
156                $video[0].pause();
157                $playBtn.removeClass("is-playing");
158            }
159        });
160
161        $video.on("ended", function () {
162            $playBtn.removeClass("is-playing");
163        });
164    });
165
166    // Auto play video of active slide
167    function playActiveSlideVideo(currentSlide) {
168        // Pause all videos
169        $(".testimonial-video").each(function () {
170            this.pause();
171            this.currentTime = 0; // reset to start
172            $(this).siblings(".play-btn").removeClass("is-playing");
173        });
174
175        // Play video inside active slide (if available)
176        var $activeSlide = $('.testimonial-slider .slick-slide[data-slick-index="' + currentSlide + '"]');
177        var $activeVideo = $activeSlide.find(".testimonial-video");
178
179        if ($activeVideo.length) {
180            $activeVideo[0].play();
181            $activeVideo.siblings(".play-btn").addClass("is-playing");
182        }
183    }
184
185    // On init -> play first active video
186    $('.testimonial-slider').on('init', function (event, slick) {
187        playActiveSlideVideo(slick.currentSlide);
188    });
189
190    // On slide change -> play current
191    $('.testimonial-slider').on('afterChange', function (event, slick, currentSlide) {
192        playActiveSlideVideo(currentSlide);
193    });
194});
195
196
197/* Dog Boarding Location Dropdown */
198document.addEventListener("DOMContentLoaded", function () {
199    const dropdown = document.getElementById("location-dropdown");
200    if (dropdown) {
201        dropdown.addEventListener("change", function () {
202            if (this.value) {
203                window.location.href = this.value;
204            }
205        });
206    }
207});
208
209
210// Hide menu If location menu is exists 
211document.addEventListener("DOMContentLoaded", function() {
212    const burger = document.querySelector(".burger-menu");
213    const shortcodeContent = document.querySelector(".shortcode-location-menu .elementor-shortcode");
214    const btnicon = document.querySelector(".hamburger-menu-icon");
215    const isSingleService = document.body.classList.contains("single-services");
216
217    // Run only if NOT on single-services page
218    if (!isSingleService && burger && shortcodeContent && btnicon) {
219        if (shortcodeContent.innerHTML.trim() !== "") {
220            burger.style.display = "none";
221            btnicon.style.display = "block";
222        } else {
223            burger.style.display = "block";
224            btnicon.style.display = "none";
225        }
226    }
227});
228
229
230
231//Location FAQ Section
232document.addEventListener("DOMContentLoaded", function() {
233    const faqItems = document.querySelectorAll(".faq-item");
234
235    faqItems.forEach(item => {
236        let question = item.querySelector(".faq-question");
237        let toggle   = item.querySelector(".faq-toggle");
238        let answer   = item.querySelector(".faq-answer");
239
240        question.addEventListener("click", function() {
241            // Close all
242            faqItems.forEach(el => {
243                el.classList.remove("active");
244                el.querySelector(".faq-answer").style.display = "none";
245                el.querySelector(".faq-toggle").textContent = "+";
246            });
247
248            // Open current
249            item.classList.add("active");
250            answer.style.display = "block";
251            toggle.textContent = "–";
252        });
253    });
254});
255
256
257
258// Toogle Active Class in responsive meu
259document.addEventListener('DOMContentLoaded', function() {
260  const icon = document.querySelector('.hamburger-menu-icon');
261  const menus = document.querySelectorAll('.shortcode-location-menu');
262
263  if (!icon || !menus.length) return;
264
265  icon.addEventListener('click', function() {
266    const isActive = icon.classList.contains('active');
267    icon.classList.toggle('active');
268
269    menus.forEach(menu => {
270      const shortcode = menu.querySelector('.elementor-shortcode');
271      
272      // check if shortcode has visible content
273      if (shortcode && shortcode.innerHTML.trim() !== "") {
274        if (!isActive) {
275          menu.classList.add('active');
276        } else {
277          menu.classList.remove('active');
278        }
279      }
280    });
281  });
282});
283
284
285// document.addEventListener("DOMContentLoaded", function() {
286//     const icon = document.querySelector(".hamburger-menu-icon .elementor-icon i");
287
288//     if (icon) {
289//         icon.addEventListener("click", function() {
290//             // Toggle between hamburger (hm) and cross (hm-cross)
291//             if (icon.classList.contains("hm") && !icon.classList.contains("hm-cross")) {
292//                 icon.classList.remove("hm");
293//                 icon.classList.add("hm-cross");
294//             } else {
295//                 icon.classList.remove("hm-cross");
296//                 icon.classList.add("hm");
297//             }
298//         });
299//     }
300// });
301
302document.addEventListener("DOMContentLoaded", function() {
303    const hamburgerIcon = document.querySelector(".huge"); // starting element
304
305    if (hamburgerIcon) {
306        hamburgerIcon.addEventListener("click", function() {
307            if (hamburgerIcon.classList.contains("huge")) {
308                // Swap to hm hm-cross
309                hamburgerIcon.classList.remove("huge", "huge-menu-01");
310                hamburgerIcon.classList.add("hm", "hm-cross");
311            } else {
312                // Swap back to huge huge-menu-01
313                hamburgerIcon.classList.remove("hm", "hm-cross");
314                hamburgerIcon.classList.add("huge", "huge-menu-01");
315            }
316        });
317    }
318});
319
320const stopBtn = document.querySelector('.st-burger-menu');
321stopBtn.addEventListener('click', () => {
322  if (document.body.style.overflow === 'hidden') {
323    document.body.style.overflow = 'auto';
324    stopBtn.textContent = "Stop Scrolling";
325  } else {
326    document.body.style.overflow = 'hidden';
327    stopBtn.textContent = "Scrolling Disabled";
328  }
329});
330
331
332//Header when scroll top
333document.addEventListener('DOMContentLoaded', function() {
334  let lastScrollTop = 0;
335  const header = document.querySelector('.main-header');
336
337  window.addEventListener('scroll', function() {
338    const currentScrollTop = window.pageYOffset || document.documentElement.scrollTop;
339
340    if (currentScrollTop <= 0) {
341      // At the top — remove fixed
342      header.classList.remove('fixed', 'hide');
343    } else if (currentScrollTop > lastScrollTop) {
344      // Scrolling down — hide header
345      header.classList.add('fixed', 'hide');
346    } else {
347      // Scrolling up — show header
348      header.classList.add('fixed');
349      header.classList.remove('hide');
350    }
351
352    lastScrollTop = currentScrollTop <= 0 ? 0 : currentScrollTop;
353  });
354});

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.