PageSourceSearch

https://www.kovalam.com/frontend/js/custom.js

js kovalam.com collected 2026-10-02 22:10:42 UTC 7,018 bytes, 252 lines download raw bytes

1(function ($) {
2
3	"use strict";
4
5	
6
7	// Scroll-Top
8	$(".scroll-top").hide();
9	$(window).on("scroll", function () {
10		if ($(this).scrollTop() > 300) {
11			$(".scroll-top").fadeIn();
12		} else {
13			$(".scroll-top").fadeOut();
14		}
15	});
16	$(".scroll-top").on("click", function () {
17		$("html, body").animate({
18			scrollTop: 0,
19		}, 700)
20	});
21
22	$('#example').DataTable();
23
24	$(document).ready(function() {
25        $( "#timepicker" ).timepicker();
26		$('.select2').select2({
27			theme: "bootstrap"
28		});
29
30	    $('.paypal').hide();
31	    $('.stripe').hide();
32	    $('.bank').hide();
33	    $('.cash-on-delivery').hide();
34
35		$('#paymentMethodChange').on('change',function() {
36
37		    if($('#paymentMethodChange').val() == 'PayPal')
38		    {
39		        $('.paypal').show();
40		        $('.stripe').hide();
41		        $('.bank').hide();
42		        $('.cash-on-delivery').hide();
43		    }
44		    else if($('#paymentMethodChange').val() == 'Stripe')
45		    {
46		        $('.paypal').hide();
47		        $('.stripe').show();
48		        $('.bank').hide();
49		        $('.cash-on-delivery').hide();
50		    }
51		    else if($('#paymentMethodChange').val() == 'Bank')
52		    {
53		    	$('.paypal').hide();
54		        $('.stripe').hide();
55		        $('.bank').show();
56		        $('.cash-on-delivery').hide();
57		    }
58		    else if($('#paymentMethodChange').val() == 'Cash On Delivery')
59		    {
60		    	$('.paypal').hide();
61		        $('.stripe').hide();
62		        $('.bank').hide();
63		        $('.cash-on-delivery').show();
64		    }
65		    else if($('#paymentMethodChange').val() == '')
66		    {
67		    	$('.paypal').hide();
68		        $('.stripe').hide();
69		        $('.bank').hide();
70		        $('.cash-on-delivery').hide();
71		    }
72
73		});
74	});
75
76
77	// Wow Active
78	new WOW().init();
79
80	// Mean Menu
81	jQuery('.mean-menu').meanmenu({
82		meanScreenWidth: "991"
83	});
84
85	// Video Popup
86	$('.video-button').magnificPopup({
87	  	type: 'iframe',
88		gallery:{
89			enabled:true
90		}
91	});
92
93	
94	$('#hotel-gallery').magnificPopup({
95        delegate: 'a.magnific-gallery',
96        type: 'image',
97        gallery: {
98            enabled: true,
99            navigateByImgClick: true,
100            preload: [0, 1]
101        },
102        image: {
103            tError: '<a href="%url%">The image</a> could not be loaded.'
104        },
105        callbacks: {
106            elementParse: function(item) {
107                item.src = item.el.attr('href');
108            }
109        }
110    });
111    
112
113    $('.photo-all').magnificPopup({
114        delegate: 'a.magnific',
115        type: 'image',
116        gallery: {
117            enabled: true,
118            navigateByImgClick: true,
119            preload: [0, 1]
120        },
121        image: {
122            tError: '<a href="%url%">The image</a> could not be loaded.'
123        }
124    });
125
126	$('.my').iconpicker();
127
128	if($(window).width() > 767) {
129		$("#sticky_sidebar").stickit({
130			top: 80,
131		})
132	}
133
134})(jQuery);
135
136
137
138/*  spScroller.js  -----------------------------------------------------------
139 *  Turns any “.sp-scroll-wrapper / .sp-scroll-content” block 
139into an
140 *  auto‑scrolling, drag‑scrollable strip—exactly the behaviour you had
141 *  inline in each Blade view.
142 *
143 *  Usage in Blade:
144 *      <div class="sp-scroll-wrapper" data-sp-scroller>
145 *          <div class="sp-scroll-content d-flex"> …cards… </div>
146 *      </div>
147 *
148 *  Just add `data-sp-scroller` (or call SpScroller.init() manually),
149 *  include this script once (footer or bundled), and you’re done.
150 * -------------------------------------------------------------------------*/
151
152const SpScroller = (() => {
153    const SCROLLER_ATTR = 'data-sp-scroller';
154    const CLONE_THRESHOLD = 4;   // if <= 4 items, clone to fill strip
155    const GAP = 10;              // card gap px
156    const AUTO_STEP_MS = 4000;   // how long before each auto move
157    const SMOOTH_MS   = 1000;    // smooth‑scroll animation length
158
159    function init(root = document) {
160        root.querySelectorAll(`[${SCROLLER_ATTR}]`).forEach(setupScroller);
161    }
162
163    function setupScroller(wrapper) {
164        const content     = wrapper.querySelector('.sp-scroll-content');
165        if (!content) return;
166
167        const items       = Array.from(content.children);
168        const itemWidth   = items[0].offsetWidth + GAP;
169        let   totalItems  = items.length;
170        let   isDown      = false, startX, scrollLeft, autoTimer;
171
172        /* Clone if strip is short */
173        if (totalItems <= CLONE_THRESHOLD) {
174            items.forEach(item => content.appendChild(item.cloneNode(true)));
175            totalItems = content.children.length;
176        }
177
178        /* Drag / touch logic */
179        wrapper.addEventListener('mousedown', e => startDrag(e.pageX));
180        wrapper.addEventListener('mousemove', e => drag(e.pageX));
181        wrapper.addEventListener('mouseup',   endDrag);
182        wrapper.addEventListener('mouseleave',endDrag);
183
184        wrapper.addEventListener('touchstart', e => startDrag(e.touches[0].pageX));
185        wrapper.addEventListener('touchmove',  e => drag(e.touches[0].pageX));
186        wrapper.addEventListener('touchend',   endDrag);
187
188        function startDrag(x) {
189            isDown   = true;
190            wrapper.classList.add('active');
191            startX   = x - wrapper.offsetLeft;
192            scrollLeft = wrapper.scrollLeft;
193            clearInterval(autoTimer);
194        }
195
196        function drag(x) {
197            if (!isDown) return;
198            const walk = (x - wrapper.offsetLeft - startX) * 2;
199            wrapper.scrollLeft = scrollLeft - walk;
200        }
201
202        function endDrag() {
203            if (!isDown) return;
204            isDown = false;
205            wrapper.classList.remove('active');
206            beginAuto();
207        }
208
209        /* Smooth scroll helper */
210        function smoothScrollBy(distance, duration = SMOOTH_MS) {
211            const start = wrapper.scrollLeft;
212            const startTime = performance.now();
213            function step(now) {
214                const progress = Math.min((now - startTime) / duration, 1);
215                const ease = 0.5 * (1 - Math.cos(Math.PI * progress));
216                wrapper.scrollLeft = start + distance * ease;
217                if (progress < 1) requestAnimationFrame(step);
218            }
219            requestAnimationFrame(step);
220        }
221
222        /* Auto scroll loop */
223        function beginAuto() {
224            autoTimer = setInterval(() => {
225                const atEnd = wrapper.scrollLeft + wrapper.clientWidth >= content.scrollWidth - 1;
226                if (atEnd) {
227                    if (totalItems <= CLONE_THRESHOLD) {
228                        wrapper.scrollLeft = 0;        // jump‑back loop
229                    } else {
230                        setTimeout(() => smoothScrollBy(-wrapper.scrollLeft), 500);
231                    }
232                } else {
233                    smoothScrollBy(itemWidth);
234                }
235            }, AUTO_STEP_MS);
236        }
237
238        beginAuto();
239    }
240
241    return { init };
242})();
243
244/* Auto‑bootstrap after DOM ready */
245document.addEventListener('DOMContentLoaded', () => SpScroller.init());
246
247
248
249
250
251
252

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.