PageSourceSearch

https://pantaisentralpark.com/wp-content/themes/psp/js/functions.js?v=1791121695

js pantaisentralpark.com collected 2026-10-04 13:47:40 UTC 15,431 bytes, 486 lines download raw bytes

1$(document).ready(function(){
2    
3    //ijm badge
4    if ($(window).scrollTop() > 200) {
5        $('.ijm-badge-container').hide();
6    }
7    
8    $(window).on('scroll', function() {
9        if ($(this).scrollTop() > 200) {
10            $('.ijm-badge-container').fadeOut();
11        } else {
12            $('.ijm-badge-container').fadeIn();
13        }
14    });
15    
16    //anchor and adjusting height 
17    $('a[href*="#"]:not([href="#"]):not(ul.horizontal a):not(a.popupgallery):not(a.popup-youtube):not(.popuptext)').click(function() {
18		
19		$('html,body').stop().animate();
20		
21        var $this = $(this);
22        if(this.hash == '#mobileMenu' || $this.parents('#mobileMenu').length > 0){
23            return;
24        }
25        
26        var target = $(this.hash);
27        
28        setTimeout(function() {
29			$('html,body').stop().animate({
30				scrollTop: target.offset().top - 150
31			}, 800,'linear');
32		}, 900);
33    });
34    
35    
36	if (location.hash){
37	    var id = $(location.hash);
38	    if(id.length == 0){
39	        id = $('[data-anchor="' + location.hash.substring(1) + '"');
40	    }
41	}
42	
43	$(window).on( "load", function() {
44        if (location.hash){
45        	$('html,body').animate({scrollTop: id.offset().top - 150}, 800, 'linear')
46      	};
47    });
48    
49    $('#goUpButton a').click(function(e) {
50        e.preventDefault();
51        $('html, body').animate({ scrollTop: 0 }, 'slow');
52    });
53    
54    // Check if the swiper element exists
55    if (document.querySelector('.home-swiper')) {
56        const homeSwiper = new Swiper('.home-swiper', {
57            loop: true,
58            slidesPerView: 1,
59            slidesPerGroup: 1,
60            loopAddBlankSlides: true,
61            speed: 1200,
62            parallax: true,
63            effect: 'fade',
64            fadeEffect: {
65                crossFade: true
66            },
67            pagination: {
68                el: '.swiper-pagination',
69            },
70            navigation: {
71                nextEl: '.swiper-button-next',
72                prevEl: '.swiper-button-prev',
73            },
74        });
75        
76    }
77    
78    $('.mobileMenuToggle').on('click', function() {
79        event.preventDefault();
80        $('#mobileSlideDownMenu').show();
81        $('.mobile-menu-wrapper').addClass('active');
82        //$('#header').css('z-index', '100000000');
83    });
84    
85    $('.mobileMenuToggleClose, #mobileSlideDownMenu .mobile-menu-content ul li a:not([href="#"])').on('click', function() {
86        //event.preventDefault();
87        //console.log('clicked close')
88        $('.mobile-menu-wrapper').removeClass('active');
89        //$('#header').css('z-index', '');
90        setTimeout(function() {
91            $('#mobileSlideDownMenu').hide();
92        }, 500);
93    });
94
95    //jarallax
96    if (window.innerWidth <= 768) { // Mobile screens condition
97        jarallax(document.querySelectorAll('.jarallax'), {
98            speed: 1, // Set speed to 0.9 for mobile devices
99        });
100    }
101
102
103    //all gsap related js code
104    gsap.registerPlugin(ScrollTrigger);
105    
106    //scrolling pin effect
107    let scrollingRow = gsap.utils.toArray(".scrolling-pin-row");
108    
109    let lastRow = $(".scrolling-last-pin");
110    let lastRowHeight = lastRow.offsetHeight;
111    
112    
113    scrollingRow.forEach((eachPanel, index) => {
114        ScrollTrigger.create({
115            trigger: eachPanel,
116            start: "top top",
117            end: () => "+=" + eachPanel.offsetHeight,  
118            pin: true,
119            pinSpacing: false,
120            toggleActions: "play none none reset",
121            refreshPriority: 1,
122            scrub: 1,
123            snap: {
124                snapTo: 1,
125                delay: -1.2,
126                anticipatePin: 1,                      
127            },
128            markers: false
129        });
130    });
131
132    
133    setTimeout(function () {
134        ScrollTrigger.create({
135            trigger: '#startLocation', // The element where scrolling starts
136            start: "top 75%", // Start when the top of #startLocation is 75% down the viewport
137            end: "bottom 15%", // End when the bottom of #startLocation reaches 25% of the viewport
138            toggleClass: {targets: '.animate-start', className: 'active'}, // Apply the 'active' class to .animate-start
139            markers: false // Set to true for debugging, remove in production
140        });
141    }, 1000);
142
143    
144
145    function createScrollAnimation(selector, animationClass) {
146        const elements = Array.from(document.querySelectorAll(selector));
147
148        elements.forEach((element) => {
149            if (!element.closest('.tab-content')) {
150                ScrollTrigger.create({
151                    trigger: element,
152                    start: 'top 90%',
153                    toggleClass: { targets: element, className: animationClass },
154                    scrub: true,
155                    once: true,
156                });
157            }
158        });
159    }
160
161    setTimeout(function () {
162        createScrollAnimation('.fadeInUp', 'animate__fadeInUp');
163        createScrollAnimation('.fadeInLeft', 'animate__fadeInLeft');
164        createScrollAnimation('.fadeInRight', 'animate__fadeInRight');
165    }, 500);
166    
167    
168/*
169const lenis = new Lenis({
170  smooth: true,
171  syncTouch: true,
172  normalizeWheel: true,
173});
174
175// Keep Lenis running
176function raf(time) {
177  lenis.raf(time);
178  requestAnimationFrame(raf);
179}
180requestAnimationFrame(raf);
181*/
182
183const lenis = new Lenis({
184  smooth: true,
185  syncTouch: true,
186  normalizeWheel: true,
187});
188
189// Function to check if the event target is inside Fancybox
190function isInsideFancybox(el) {
191  return el.closest(".fancybox__container") !== null;
192}
193
194// Prevent Lenis from affecting Fancybox popups
195document.addEventListener("wheel", (event) => {
196  if (isInsideFancybox(event.target)) {
197    event.stopPropagation(); // Allow native scrolling inside Fancybox
198  }
199}, { passive: false });
200
201document.addEventListener("touchmove", (event) => {
202  if (isInsideFancybox(event.target)) {
203    event.stopPropagation(); // Prevent Lenis from hijacking touch scrolling inside Fancybox
204  }
205}, { passive: false });
206
207// Keep Lenis running but ignore Fancybox
208function raf(time) {
209  if (!document.querySelector(".fancybox__container")) {
210    lenis.raf(time); // Only run Lenis if Fancybox is not open
211  }
212  requestAnimationFrame(raf);
213}
214
215requestAnimationFrame(raf);
216
217
218Fancybox.bind("[data-fancybox]", {
219    autoFocus: false,
220    trapFocus: false,
221    touch: {
222      vertical: true,
223      momentum: true,
224    },
225    hideScrollbar: false,
226  });
227    
228    
229    
230    //gravityform configuration
231    //registration form
232    $(document).bind('gform_post_render', function(){
233        
234        var $allCountryCode = $('select[name="mobile_no_country_code"]');
235
236        //if the homepage form exist
237        if($('div#gform_wrapper_1').length > 0) {
238            $('#input_1_5').html($allCountryCode.html());
239            //$("#input_1_5 option:first").attr('selected','selected');
240            $('#input_1_5').prependTo('div#field_1_5 .ginput_container');
241
242        }
243        
244    });
245    
246    //project auto select on link click
247    $('.project-selector').on('click', function(e) {
248        var selectedProject = $(this).data('select');
249        $('.project_select_field select').val(selectedProject);
250    });
251
252    //live phone validation
253    $('.phone-restrict input').on('input', function() {
254        var phoneValue = $(this).val();
255        phoneValue = phoneValue.replace(/\D/g, '').substring(0, 10);
256        $(this).val(phoneValue);
257    });
258    
259    $('.phone-restrict input').attr('autocomplete', 'off');
260    
261    if($('.popup-close-image').length > 0) {
262        $('.popup-close-image').on('click', function () {
263            $('.pum-close').trigger( "click" );
264        });
265    }
266    
267    
268    //Home Feature Swiper
269    const homeFeaSwiper = new Swiper('.home-fea-swiper', {
270        loop: true,
271        slidesPerView: 1,
272        slidesPerGroup: 1,
273        loopAddBlankSlides: true,
274        speed: 1200,
275        parallax: true,
276        effect: 'fade',
277        fadeEffect: {
278            crossFade: true
279        },
280        // pagination: {
281        //     el: '.swiper-pagination',
282        // },
283        navigation: {
284            nextEl: '.home-fea-swiper .swiper-button-next',
285            prevEl: '.home-fea-swiper .swiper-button-prev',
286        },
287    });
288    
289    //enLace Suites Txt and Img Gallery Swiper 1
290    const enlaceGalleryOneSwiper = new Swiper('.enlace-suite-gallery-1-swiper', {
291        loop: true,
292        speed: 1200,
293        pagination: {
294            el: '.enlace-suite-gallery-1-swiper-pagination',
295            type: 'fraction',
296        },
297        navigation: {
298            nextEl: '.enlace-suite-gallery-1-button-next',
299            prevEl: '.enlace-suite-gallery-1-button-prev',
300        },
301    });
302    
303    //enLace Suites Txt and Img Gallery Swiper 2
304    const enlaceGalleryOneSwiper2 = new Swiper('.enlace-suite-gallery-2-swiper', {
305        loop: true,
306        speed: 1200,
307        pagination: {
308            el: '.enlace-suite-gallery-2-swiper-pagination',
309            type: 'fraction',
310        },
311        navigation: {
312            nextEl: '.enlace-suite-gallery-2-button-next',
313            prevEl: '.enlace-suite-gallery-2-button-prev',
314        },
315    });
316    
317    //enLace Suites Txt and Img Gallery Swiper 3
318    const enlaceGalleryOneSwiper3 = new Swiper('.enlace-suite-gallery-3-swiper', {
319        loop: true,
320        speed: 1200,
321        pagination: {
322            el: '.enlace-suite-gallery-3-swiper-pagination',
323            type: 'fraction',
324        },
325        navigation: {
326            nextEl: '.enlace-suite-gallery-3-button-next',
327            prevEl: '.enlace-suite-gallery-3-button-prev',
328        },
329    });
330    
331    //enLace Suites Txt and Img Gallery Swiper 4
332    const enlaceGalleryOneSwiper4 = new Swiper('.enlace-suite-gallery-4-swiper', {
333        loop: true,
334        speed: 1200,
335        pagination: {
336            el: '.enlace-suite-gallery-4-swiper-pagination',
337            type: 'fraction',
338        },
339        navigation: {
340            nextEl: '.enlace-suite-gallery-4-button-next',
341            prevEl: '.enlace-suite-gallery-4-button-prev',
342        },
343    });
344    
345    //enLace Suites Txt and Img Gallery Swiper 5
346    const enlaceGalleryOneSwiper5 = new Swiper('.enlace-suite-gallery-5-swiper', {
347        loop: true,
348        speed: 1200,
349        pagination: {
350            el: '.enlace-suite-gallery-5-swiper-pagination',
351            type: 'fraction',
352        },
353        navigation: {
354            nextEl: '.enlace-suite-gallery-5-button-next',
355            prevEl: '.enlace-suite-gallery-5-button-prev',
356        },
357    });
358    
359    //enLace Suites Txt and Img Gallery Swiper 6
360    const enlaceGalleryOneSwiper6 = new Swiper('.enlace-suite-gallery-6-swiper', {
361        loop: true,
362        speed: 1200,
363        pagination: {
364            el: '.enlace-suite-gallery-6-swiper-pagination',
365            type: 'fraction',
366        },
367        navigation: {
368            nextEl: '.enlace-suite-gallery-6-button-next',
369            prevEl: '.enlace-suite-gallery-6-button-prev',
370        },
371    });
372    
373    
374    //enLace Suites Floorplan
375    $(".floor-type-but-group .floor-type-but").on("click", function() {
376        var type = $(this).attr('data-type');
377        $(this).addClass('active').siblings().removeClass('active');
378        $('[data-floorplan="' + type + '"]').addClass('active').siblings().removeClass('active');
379    });
380    
381    
382    //IJM Badge add class in enlace suite page
383    if (window.location.pathname.includes("/enlace-suites")) {
384        const ijmBadge = document.querySelector(".ijm-badge-container"); // Change this selector to match your div
385        
386        if(ijmBadge) {
387            ijmBadge.classList.add("enlace-ijmbadge"); // Change "new-class" to whatever class you want to add
388        }
389        const $pageContent = $('#pageContent');
390        
391        $pageContent.css("padding-top", "0");
392        
393    }
394    
395    
396    //Secondary Menu Hamburger
397    if($('.secondary-menu-box .menu-hamburger button').length > 0) {
398        const secondMenuhamburger = document.querySelector(".secondary-menu-box .menu-hamburger button");
399        const secondMenuBox = document.querySelector(".secondary-menu-box .menu-box");
400        const secondMenuItems = document.querySelectorAll(".secondary-menu-box .menu-box .menu-item a");
401        
402        secondMenuhamburger.addEventListener("click", function(){
403            secondMenuBox.classList.toggle("active");
404        });
405        
406        secondMenuItems.forEach(menu => {
407            menu.addEventListener("click", function() {
408                secondMenuBox.classList.remove("active");
409            });
410        });
411    };
412    
413    
414    // 1. Grab our buttons
415    const btnSuite1 = document.querySelector('.single-click-floorplan-box.ensuite1');
416    const btnSuite2 = document.querySelector('.single-click-floorplan-box.ensuite2');
417
418    // 2. Grab our containers
419    const container1 = document.querySelector('.tab-card-container');
420    const container2 = document.querySelector('.tab-card-container-2');
421
422    // Make sure elements exist before running logic
423    if (btnSuite1 && btnSuite2 && container1 && container2) {
424        
425        // Handle Enlace Suites I click
426        btnSuite1.addEventListener('click', function(e) {
427            e.preventDefault(); // Stop link from jumping to top of page
428            
429            // Update Buttons
430            btnSuite1.classList.add('active');
431            btnSuite2.classList.remove('active');
432            
433            // Update Containers
434            container1.classList.add('active');
435            container2.classList.remove('active');
436        });
437
438        // Handle Enlace Suites II click
439        btnSuite2.addEventListener('click', function(e) {
440            e.preventDefault(); // Stop link from jumping to top of page
441            
442            // Update Buttons
443            btnSuite2.classList.add('active');
444            btnSuite1.classList.remove('active');
445            
446            // Update Containers
447            container2.classList.add('active');
448            container1.classList.remove('active');
449        });
450    }
451    
452    
453    
454    // Select all the floorplan buttons
455    const floorPlanLowUpButtons = document.querySelectorAll('.lower-upper-btn');
456    
457    floorPlanLowUpButtons.forEach(button => {
458        button.addEventListener('click', function() {
459          // Find the parent wrapper to keep changes contained to this specific block
460          const wrapper = this.closest('.lower-upper-wrapper');
461          
462          // Get the target floorplan string (e.g., 'en2-typeRG1-lower')
463          const targetFloorplan = this.getAttribute('data-floorplan');
464        
465          // 1. Update Buttons
466          // Remove 'active' from all buttons in this wrapper
467          wrapper.querySelectorAll('.lower-upper-btn').forEach(btn => {
468            btn.classList.remove('active');
469          });
470          // Add 'active' to the clicked button
471          this.classList.add('active');
472        
473          // 2. Update Images
474          // Remove 'active' from all images in this wrapper
475          wrapper.querySelectorAll('img[data-floorplan]').forEach(img => {
476            img.classList.remove('active');
477          });
478          // Add 'active' to the corresponding image
479          const targetImg = wrapper.querySelector(`img[data-floorplan="${targetFloorplan}"]`);
480          if (targetImg) {
481            targetImg.classList.add('active');
482          }
483        });
484    });
485    
486});

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.