PageSourceSearch

https://weavervillehotel.com/wp-content/themes/thecappa-countryside/assets/js/custom.js?ver=7.1.3

js weavervillehotel.com collected 2026-10-08 19:28:03 UTC 17,026 bytes, 646 lines download raw bytes

1/* -------------------------------------------------------
2
3[ Custom settings ]
4
501. ScrollIt
602. Navbar scrolling background
703. Close navbar-collapse when a  clicked
804. Sections background image from data background 
905. Animations
1006. YouTubePopUp
1107. Testimonials owlCarousel
1208. Rooms owlCarousel
1309. Pricing owlCarousel
1410. News owlCarousel
1511. Team owlCarousel
1612. Clients owlCarousel
1713. Restaurant Menu owlCarousel
1814. Restaurant Menu Tabs
1915. Accordion Box (for Faqs)
2016. MagnificPopup Gallery
2117. Smooth Scrolling
2218. Scroll back to top
2319. Select2
2420. Datapicker
2521. Slider
2622. Preloader
2723. Contact Form
28
29------------------------------------------------------- */
30$(function () {
31	"use strict";
32	var wind = $(window);
33	
34	// ScrollIt
35	$.scrollIt({
36		upKey: 38, // key code to navigate to the next section
37		downKey: 40, // key code to navigate to the previous section
38		easing: 'swing', // the easing function for animation
39		scrollTime: 600, // how long (in ms) the animation takes
40		activeClass: 'active', // class given to the active nav element
41		onPageChange: null, // function(pageIndex) that is called when page is changed
42		topOffset: -70 // offste (in px) for fixed top navigation
43	});
44	
45	// Navbar scrolling background
46	wind.on("scroll", function () {
47		var bodyScroll = wind.scrollTop(),
48			navbar = $(".navbar");
49		if (bodyScroll > 100) {
50			navbar.addClass("nav-scroll");
51		} else {
52			navbar.removeClass("nav-scroll");
53		}
54	});
55	
56	// Close navbar-collapse when a  clicked
57	$(".navbar-nav .dropdown-item a").on('click', function () {
58		$(".navbar-collapse").removeClass("show");
59	});
60	
61	// Sections background image from data background
62	var pageSection = $(".bg-img, section");
63	pageSection.each(function (indx) {
64		if ($(this).attr("data-background")) {
65			$(this).css("background-image", "url(" + $(this).data("background") + ")");
66		}
67	});
68
69	// Animations
70	var contentWayPoint = function () {
71		var i = 0;
72		$('.animate-box').waypoint(function (direction) {
73			if (direction === 'down' && !$(this.element).hasClass('animated')) {
74				i++;
75				$(this.element).addClass('item-animate');
76				setTimeout(function () {
77					$('body .animate-box.item-animate').each(function (k) {
78						var el = $(this);
79						setTimeout(function () {
80							var effect = el.data('animate-effect');
81							if (effect === 'fadeIn') {
82								el.addClass('fadeIn animated');
83							} else if (effect === 'fadeInLeft') {
84								el.addClass('fadeInLeft animated');
85							} else if (effect === 'fadeInRight') {
86								el.addClass('fadeInRight animated');
87							} else {
88								el.addClass('fadeInUp animated');
89							}
90							el.removeClass('item-animate');
91						}, k * 200, 'easeInOutExpo');
92					});
93				}, 100);
94			}
95		}, {
96			offset: '85%'
97		});
98	};
99	$(function () {
100		contentWayPoint();
101	});
102	 
103	// YouTubePopUp
104	$("a.vid").YouTubePopUp();
105	
106	// Testimonials owlCarousel *
107	$('.testimonials .owl-carousel').owlCarousel({
108		loop: true,
109		margin: 30,
110		mouseDrag: true,
111		autoplay: false,
112		autoplayTimeout: 9000,
113		dots: false,
114		nav: false,
115		navText: ["<span class='lnr ti-angle-left'></span>", "<span class='lnr ti-angle-right'></span>"],
116		responsiveClass: true,
117		responsive: {
118			0: {
119				items: 1,
120			},
121			600: {
122				items: 1
123			},
124			1000: {
125				items: 1
126			}
127		}
128	});
129	
130	// Rooms owlCarousel *
131	$('.rooms1 .owl-carousel').owlCarousel({
132		loop: true,
133		margin: 30,
134		mouseDrag: true,
135		autoplay: false,
136		dots: true,
137		autoplayHoverPause: true,
138		nav: false,
139		navText: ["<span class='lnr ti-angle-left'></span>","<span class='lnr ti-angle-right'></span>"],
140		responsiveClass: true,
141		responsive: {
142			0: {
143				items: 1,
144			},
145			600: {
146				items: 2
147			},
148			1000: {
149				items: 2
150			}
151		}
152	});
153	
154	$('.rooms2 .owl-carousel').owlCarousel({
155		loop: true,
156		margin: 30,
157		mouseDrag: true,
158		autoplay: false,
159		dots: true,
160		autoplayHoverPause: true,
161		nav: false,
162		navText: ["<span class='lnr ti-angle-left'></span>","<span class='lnr ti-angle-right'></span>"],
163		responsiveClass: true,
164		responsive: {
165			0: {
166				items: 1,
167			},
168			600: {
169				items: 2,
170			},
171			1000: {
172				items: 3,
173			}
174		}
175	});
176	
177	// Pricing owlCarousel *
178	$('.pricing .owl-carousel').owlCarousel({
179		loop: true,
180		margin: 30,
181		mouseDrag: true,
182		autoplay: false,
183		dots: true,
184		autoplayHoverPause: true,
185		nav: false,
186		navText: ["<span class='lnr ti-angle-left'></span>","<span class='lnr ti-angle-right'></span>"],
187		responsiveClass: true,
188		responsive: {
189			0: {
190				items: 1
191			},
192			600: {
193				items: 2
194			},
195			1000: {
196				items: 3
197			}
198		}
199	});
200	
201	// News owlCarousel *
202	$('.news .owl-carousel').owlCarousel({
203		loop: true,
204		margin: 30,
205		mouseDrag: true,
206		autoplay: false,
207		dots: false,
208		nav: true,
209		navText: ["<span class='lnr ti-angle-left'></span>","<span class='lnr ti-angle-right'></span>"],
210		responsiveClass: true,
211		responsive: {
212			0: {
213				items: 1,
214				dots: true,
215				nav: false
216			},
217			600: {
218				items: 2,
219				dots: true,
220				nav: false
221			},
222			1000: {
223				items: 3
224			}
225		}
226	});
227	
228	// Team owlCarousel *
229	$('.team .owl-carousel').owlCarousel({
230		loop: true,
231		margin: 30,
232		dots: true,
233		mouseDrag: true,
234		autoplay: false,
235		nav: false,
236		navText: ["<span class='lnr ti-angle-left'></span>","<span class='lnr ti-angle-right'></span>"],
237		responsiveClass: true,
238		responsive: {
239			0: {
240				items: 1,
241				dots: true
242			},
243			600: {
244				items: 2
245			},
246			1000: {
247				items: 3
248			}
249		}
250	});
251	
252	// Clients owlCarousel *
253	$('.clients .owl-carousel').owlCarousel({
254		loop: true,
255		margin: 30,
256		mouseDrag: true,
257		autoplay: true,
258		dots: false,
259		nav: false,
260		navText: ["<span class='lnr ti-angle-left'></span>","<span class='lnr ti-angle-right'></span>"],
261		responsiveClass: true,
262		responsive: {
263			0: {
264				margin: 10,
265				items: 3
266			},
267			600: {
268				items: 3
269			},
270			1000: {
271				items: 4
272			}
273		}
274	});
275	
276	// Restaurant Menu owlCarousel
277	$('.restaurant-menu .owl-carousel').owlCarousel({
278		loop: true,
279		margin: 0,
280		autoplay: false,
281		dots: false,
282		nav: true,
283		navText: ["<span class='lnr ti-angle-left'></span>","<span class='lnr ti-angle-right'></span>"],
284		responsiveClass: true,
285		responsive: {
286			0: {
287				items: 2,
288				nav: false
289			},
290			600: {
291				items: 3,
292				nav: false
293			},
294			1000: {
295				items: 4
296			}
297		}
298	});
299	
300	// Restaurant Menu Tabs
301	$(".restaurant-menu .tabs-icon").on("click", ".item", function () {
302		$(".item").removeClass("active");
303		var myID = $(this).attr("id");
304		$(".restaurant-menu .cont").hide();
305		$("#" + myID + "-content").fadeIn();
306	});
307	$(".restaurant-menu .tabs-icon").on("click", ".owl-item", function () {
308		$(this).addClass("actived").siblings().removeClass("actived");
309	});
310	
311	// Accordion Box (for Faqs)
312	if ($(".accordion-box").length) {
313		$(".accordion-box").on("click", ".acc-btn", function () {
314			var outerBox = $(this).parents(".accordion-box");
315			var target = $(this).parents(".accordion");
316			if ($(this).next(".acc-content").is(":visible")) {
317				//return false;
318				$(this).removeClass("active");
319				$(this).next(".acc-content").slideUp(300);
320				$(outerBox).children(".accordion").removeClass("active-block");
321			} else {
322				$(outerBox).find(".accordion .acc-btn").removeClass("active");
323				$(this).addClass("active");
324				$(outerBox).children(".accordion").removeClass("active-block");
325				$(outerBox).find(".accordion").children(".acc-content").slideUp(300);
326				target.addClass("active-block");
327				$(this).next(".acc-content").slideDown(300);
328			}
329		});
330	}
331	
332	// MagnificPopup Gallery
333	$('.gallery').magnificPopup({
334		delegate: '.popimg',
335		type: 'image',
336		gallery: {
337			enabled: true
338		}
339	});
340	$(".img-zoom").magnificPopup({
341		type: "image",
342		closeOnContentClick: !0,
343		mainClass: "mfp-fade",
344		gallery: {
345			enabled: !0,
346			navigateByImgClick: !0,
347			preload: [0, 1]
348		}
349	})
350	$('.magnific-youtube, .magnific-vimeo, .magnific-custom').magnificPopup({
351		disableOn: 700,
352		type: 'iframe',
353		mainClass: 'mfp-fade',
354		removalDelay: 300,
355		preloader: false,
356		fixedContentPos: false
357	});
358	
359	// Smooth Scrolling
360	$('a[href*="#"]')
361	// Remove links that don't actually link to anything
362	.not('[href="#"]').not('[href="#0"]').not('.no-scroll').not('[class="comment-reply-link"]').not('[id="cancel-comment-reply-link"]').click(function (event) {
363		// On-page links
364		if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
365			// Figure out element to scroll to
366			var target = $(this.hash);
367			target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
368			// Does a scroll target exist?
369			if (target.length) {
370				// Only prevent default if animation is actually gonna happen
371				event.preventDefault();
372				$('html, body').animate({
373					scrollTop: target.offset().top - 70
374				}, 1000, function () {
375					setTimeout(function () {
376                        $('html, body').animate({
377                            scrollTop: target.offset().top - 70
378                        }, 500); // Duration of the second scroll
379                    }, 0); 
380					// Callback after animation
381					// Must change focus!
382					var $target = $(target);
383					$target.focus();
384					if ($target.is(":focus")) { // Checking if the target was focused
385						return false;
386					} else {
387						$target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable
388						$target.focus(); // Set focus again
389					};
390				});
391			}
392		}
393	});
394	
395	//  Scroll back to top
396	var progressPath = document.querySelector('.progress-wrap path');
397	var pathLength = progressPath.getTotalLength();
398	progressPath.style.transition = progressPath.style.WebkitTransition = 'none';
399	progressPath.style.strokeDasharray = pathLength + ' ' + pathLength;
400	progressPath.style.strokeDashoffset = pathLength;
401	progressPath.getBoundingClientRect();
402	progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear';
403	var updateProgress = function () {
404		var scroll = $(window).scrollTop();
405		var height = $(document).height() - $(window).height();
406		var progress = pathLength - (scroll * pathLength / height);
407		progressPath.style.strokeDashoffset = progress;
408	}
409	updateProgress();
410	$(window).scroll(updateProgress);
411	var offset = 150;
412	var duration = 550;
413	jQuery(window).on('scroll', function () {
414		if (jQuery(this).scrollTop() > offset) {
415			jQuery('.progress-wrap').addClass('active-progress');
416		} else {
417			jQuery('.progress-wrap').removeClass('active-progress');
418		}
419	});
420	jQuery('.progress-wrap').on('click', function (event) {
421		event.preventDefault();
422		jQuery('html, body').animate({
423			scrollTop: 0
424		}, duration);
425		return false;
426	})
427	
428	// Select2
429	$('.select2').select2({
430		minimumResultsForSearch: Infinity,
431	});
432	
433	// Datapicker
434	$(".datepicker").datepicker({
435		orientation: "top"
436	});  
437});
438
439// Slider  
440$(document).ready(function () {
441	var owl = $('.header .owl-carousel');
442	// Slider owlCarousel - (Inner Page Slider)
443	$('.slider .owl-carousel').owlCarousel({
444		items: 1,
445		loop: true,
446		dots: true,
447		margin: 0,
448		autoplay: false,
449		autoplayTimeout: 5000,
450		nav: false,
451		navText: ['<i class="ti-angle-left" aria-hidden="true"></i>', '<i class="ti-angle-right" aria-hidden="true"></i>'],
452		responsiveClass: true,
453		responsive: {
454			0: {
455				dots: true
456			},
457			600: {
458				dots: true
459			},
460			1000: {
461				dots: true
462			}
463		}
464	});
465	// Slider owlCarousel (Homepage Slider)
466	$('.slider-fade .owl-carousel').owlCarousel({
467		items: 1,
468		loop: true,
469		dots: false,
470		margin: 0,
471		autoplay: false,
472		autoplayTimeout: 5000,
473		animateOut: 'fadeOut',
474		nav: true,
475		navText: ['<i class="ti-angle-left" aria-hidden="true"></i>', '<i class="ti-angle-right" aria-hidden="true"></i>'],
476		responsiveClass: true,
477		responsive: {
478			0: {
479				dots: false
480			},
481			600: {
482				dots: false
483			},
484			1000: {
485				dots: false
486			}
487		}
488	});
489	owl.on('changed.owl.carousel', function (event) {
490		var item = event.item.index - 2; // Position of the current item
491		$('span').removeClass('animated fadeInUp');
492		$('h4').removeClass('animated fadeInUp');
493		$('h1').removeClass('animated fadeInUp');
494		$('p').removeClass('animated fadeInUp');
495		$('.butn-light').removeClass('animated fadeInUp');
496		$('.butn-dark').removeClass('animated fadeInUp');
497		$('.owl-item').not('.cloned').eq(item).find('span').addClass('animated fadeInUp');
498		$('.owl-item').not('.cloned').eq(item).find('h4').addClass('animated fadeInUp');
499		$('.owl-item').not('.cloned').eq(item).find('h1').addClass('animated fadeInUp');
500		$('.owl-item').not('.cloned').eq(item).find('p').addClass('animated fadeInUp');
501		$('.owl-item').not('.cloned').eq(item).find('.butn-light').addClass('animated fadeInUp');
502		$('.owl-item').not('.cloned').eq(item).find('.butn-dark').addClass('animated fadeInUp');
503	});
504});
505
506// Preloader
507$("#preloader").fadeOut(700);
508	$(".preloader-bg").delay(700).fadeOut(700);
509	var wind = $(window);
510
511// Contact Form
512var form = $('.contact__form'),
513	message = $('.contact__msg'),
514	form_data;
515	// success function
516	function done_func(response) {
517		message.fadeIn().removeClass('alert-danger').addClass('alert-success');
518		message.text(response);
519		setTimeout(function () {
520			message.fadeOut();
521		}, 2000);
522		form.find('input:not([type="submit"]), textarea').val('');
523	}
524	// fail function
525	function fail_func(data) {
526		message.fadeIn().removeClass('alert-success').addClass('alert-success');
527		message.text(data.responseText);
528		setTimeout(function () {
529			message.fadeOut();
530		}, 2000);
531	}
532	form.submit(function (e) {
533		e.preventDefault();
534		form_data = $(this).serialize();
535		$.ajax({
536			type: 'POST',
537			url: form.attr('action'),
538			data: form_data
539		}).done(done_func).fail(fail_func);
540	});
541 document.addEventListener("DOMContentLoaded", function () {
542        const galleryThumbs = new Swiper('.gallery-thumbs', {
543            spaceBetween: 10,
544            slidesPerView: 4,
545            freeMode: true,
546            watchSlidesProgress: true,
547        });
548
549        const galleryMain = new Swiper('.gallery-main', {
550            spaceBetween: 10,
551            navigation: {
552                nextEl: '.swiper-button-next',
553                prevEl: '.swiper-button-prev',
554            },
555            thumbs: {
556                swiper: galleryThumbs,
557            },
558        });
559    });
560
561    document.querySelectorAll('.icon-btn').forEach(button => {
562        button.addEventListener('click', function() {
563            var targetModal = this.getAttribute('data-bs-target');
564            var modalElement = document.querySelector(targetModal);
565
566            if (!modalElement.dataset.modalInitialized) {
567                modalElement.modalInstance = new bootstrap.Modal(modalElement);
568                modalElement.dataset.modalInitialized = "true";
569            }
570
571            modalElement.modalInstance.show();
572        });
573    });
574
575    
576jQuery(document).ready(function($) {
577    $('.modal').on('show.bs.modal', function() {
578        var modal = this;
579        var $modal = $(modal);
580        var mainSlider = modal.querySelector('.product-main-slider');
581        var thumbSlider = modal.querySelector('.product-thumbnail-slider');
582
583        if (!mainSlider || !thumbSlider) return;
584
585        var mainSwiper = $modal.data('mainSwiper');
586        var thumbSwiper = $modal.data('thumbSwiper');
587
588        if (!mainSwiper || !thumbSwiper) {
589            thumbSwiper = new Swiper(thumbSlider, {
590                loop: true,
591                spaceBetween: 10,
592                slidesPerView: 4,
593                freeMode: true,
594                watchSlidesVisibility: true,
595                watchSlidesProgress: true,
596            });
597
598            mainSwiper = new Swiper(mainSlider, {
599                loop: true,
600                spaceBetween: 10,
601                navigation: {
602                    nextEl: mainSlider.querySelector('.swiper-button-next'),
603                    prevEl: mainSlider.querySelector('.swiper-button-prev'),
604                },
605                pagination: {
606                    el: mainSlider.querySelector('.swiper-pagination'),
607                    clickable: true,
608                },
609                thumbs: {
610                    swiper: thumbSwiper
611                }
612            });
613
614            $modal.data({
615                mainSwiper: mainSwiper,
616                thumbSwiper: thumbSwiper
617            });
618        } else {
619            mainSwiper.update();
620            thumbSwiper.update();
621        }
622    });
623
624    $(document).on('click', '[data-bs-dismiss="modal"]', function () {
625        var modal = $(this).closest('.modal');
626        var bsModal = bootstrap.Modal.getInstance(modal[0]);
627        if (bsModal) {
628            bsModal.hide();
629        }
630    });
631
632    $('.modal').on('hidden.bs.modal', function() {
633        $('.modal-backdrop').remove();
634
635        setTimeout(function () {
636            if (!$('.modal.show').length) {
637                $('body').css('overflow', '').css('padding-right', '');
638            }
639        }, 10);
640    });
641});
642
643document.addEventListener("DOMContentLoaded", function () {
644    const currentYear = new Date().getFullYear();
645    document.getElementById("current-year").textContent = currentYear;
646});

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.