PageSourceSearch

https://www.youhaverealty.com/themes/public-common-files/js/init.js

js youhaverealty.com collected 2026-10-07 15:36:01 UTC 17,849 bytes, 636 lines download raw bytes

1// page init
2jQuery(function () {
3    ImageFitCont();
4    FixedHeader();
5    ProjectSlider();
6    ProjectGallery();
7    // homeBannerSliderInit();
8    // homeLogoSliderInit();
9});
10
11// Image Fit Container
12function ImageFitCont() {
13    $('.imageFit').imgLiquid({
14        fill: true,
15        horizontalAlign: 'center',
16        verticalAlign: 'center'
17    });
18}
19
20// Fixed Header
21function FixedHeader() {
22    var lastScrollTop = 0, delta = 5;
23
24    $(window).scroll(function (event) {
25        var st = $(this).scrollTop();
26
27        if (Math.abs(lastScrollTop - st) <= delta)
28            return;
29
30        if (st > lastScrollTop) {
31            // downscroll code
32            $('.site-header').addClass('fix-head');
33        }
34        if (st < 50) {
35            // downscroll code
36            $('.site-header').removeClass('fix-head');
37        }
38        else {
39            // upscroll code
40            //$('.site-header').removeClass('fix-head');
41        }
42        lastScrollTop = st;
43    });
44
45}
46
47function ProjectSlider() {
48
49    const projectSlider_swiper = new Swiper('.project-slider', {
50        navigation: {
51            nextEl: '.project-slider .swiper-button-next',
52            prevEl: '.project-slider .swiper-button-prev',
53        },
54        slidesPerView: 1,
55        spaceBetween: 30,
56        breakpoints: {
57            320: {
58                slidesPerView: 1,
59            },
60            768: {
61                slidesPerView: 2
62            },
63            992: {
64                slidesPerView: 2
65            },
66            1200: {
67                slidesPerView: 3
68            }
69        }
70    });
71
72    const homeProjectSlider_swiper = new Swiper('.project-slider.home-project-slider', {
73        navigation: {
74            nextEl: '.project-slider.home-project-slider .swiper-button-next',
75            prevEl: '.project-slider.home-project-slider .swiper-button-prev',
76        },
77        slidesPerView: 1,
78        spaceBetween: 28,
79        breakpoints: {
80            320: {
81                slidesPerView: 1,
82            },
83            768: {
84                slidesPerView: 2
85            },
86            992: {
87                slidesPerView: 3
88            },
89            1200: {
90                slidesPerView: 4
91            }
92        }
93    });
94
95    const homeTopSlider_swiper = new Swiper('.project-slider.home-top-slider', {
96        navigation: {
97            nextEl: '.project-slider.home-top-slider .swiper-button-next',
98            prevEl: '.project-slider.home-top-slider .swiper-button-prev',
99        },
100        slidesPerView: 1,
101        spaceBetween: 0,
102        breakpoints: {
103            320: {
104                slidesPerView: 1,
105            },
106            768: {
107                slidesPerView: 2
108            },
109            992: {
110                slidesPerView: 3
111            },
112            1200: {
113                slidesPerView: 4
114            }
115        }
116    });
117
118}
119
120function ProjectSliderOld() {
121    $('.project-slider').swiper({
122        nextButton: '.project-slider .swiper-button-next',
123        prevButton: '.project-slider .swiper-button-prev',
124        slidesPerView: 3,
125        spaceBetween: 30,
126        breakpoints: {
127            1024: {
128                slidesPerView: 2
129            },
130            768: {
131                slidesPerView: 1
132            }
133        }
134    });
135    $('.project-slider.home-project-slider').swiper({
136        nextButton: '.project-slider .swiper-button-next',
137        prevButton: '.project-slider .swiper-button-prev',
138        slidesPerView: 4,
139        spaceBetween: 28,
140        breakpoints: {
141            1024: {
142                slidesPerView: 2
143            },
144            768: {
145                slidesPerView: 1
146            }
147        }
148    });
149    $('.project-slider.home-top-slider').swiper({
150        nextButton: '.project-slider .swiper-button-next',
151        prevButton: '.project-slider .swiper-button-prev',
152        slidesPerView: 4,
153        //autoplay: 2500,
154        //autoplayDisableOnInteraction: false
155        spaceBetween: 0,
156
157        breakpoints: {
158            1024: {
159                slidesPerView: 2
160            },
161            768: {
162                slidesPerView: 1
163            }
164        }
165    });
166
167
168}
169
170function ProjectGallery() {
171    $('#image-gallery').lightSlider({
172        gallery: true,
173        item: 1,
174        thumbItem: 9,
175        slideMargin: 0,
176        speed: 500,
177        auto: true,
178        loop: true,
179        onSliderLoad: function () {
180            $('#image-gallery').removeClass('cS-hidden');
181        }
182    });
183}
184
185$(document).on('click', function (e) {
186    var elem = $(e.target).closest('.box-handel'),
187        box = $(e.target).closest('.box-form');
188
189    if (elem.length) {
190        e.preventDefault();
191        $('.box-form').slideToggle();
192    } else if (!box.length) {
193        $('.box-form').hide();
194    }
195});
196
197$(document).on('shown.bs.tab', function () {
198    ProjectSlider();
199});
200
201$(document).ready(function () {
202
203    // Equal Height
204    if ($(window).width() > 767) {
205        $('.dev-blocks').each(function () {
206            var highestBox = 0;
207            $('.dev-block', this).each(function () {
208                if ($(this).height() > highestBox) {
209                    highestBox = $(this).height();
210                }
211            });
212            $('.dev-block', this).height(highestBox);
213        });
214    }
215});
216
217
218$(window).load(function () {
219    setTimeout(function () {
220        $('.quick-contact-box').addClass('anim-up');
221    }, 2000);
222
223    var timeout = null;
224
225    $(document).on('mousemove', function () {
226        $('.quick-contact-box').addClass('anim-up');
227        clearTimeout(timeout);
228
229        timeout = setTimeout(function () {
230            $('.quick-contact-box').removeClass('anim-up');
231        }, 8000);
232    });
233
234    //$('#ninja-slider').NinjaSlider();
235
236
237});
238
239function HomeGalleryGrid() {
240    $('.gal-mesonry .grid').isotope({
241        // options
242        itemSelector: '.grid-item',
243        layoutMode: 'masonry'
244    });
245}
246function HomeGalleryGrid2() {
247    $('.gal-mesonry2 .grid').isotope({
248        // options
249        itemSelector: '.grid-item',
250        layoutMode: 'masonry'
251    });
252}
253$(document).ready(function () {
254    $('.rental-class a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
255        var targethref = e.target.hash;
256
257        if (targethref == '#rentals1')
258            HomeGalleryGrid2();
259        else
260            HomeGalleryGrid();
261    })
262});
263
264// --------- projectDetail-imgVideo-slider -------------
265
266function projectDetailImgVideoSwiperSlider() {
267    var projectDetail_imgVideo_sliderSwiper = new Swiper(".projectDetail-imgVideo-slider .swiper-container", {
268        loop: true,
269        spaceBetween: 0,
270        slidesPerView: 1,
271        navigation: {
272            nextEl: ".projectDetail-imgVideo-slider .swiper-button-next",
273            prevEl: ".projectDetail-imgVideo-slider .swiper-button-prev",
274        },
275        pagination: {
276            el: '.projectDetail-imgVideo-slider .swiper-pagination',
277            type: 'fraction',
278            formatFractionCurrent: function (number) {
279                return ('0' + number).slice(-2);
280            },
281            formatFractionTotal: function (number) {
282                return ('0' + number).slice(-2);
283            },
284            renderFraction: function (currentClass, totalClass) {
285                return '<span class="pagination-text"><span class="' + currentClass + '"></span>' +
286                    ' / ' +
287                    '<span class="' + totalClass + '"></span></span>';
288            }
289        },
290    });
291
292    projectDetail_imgVideo_sliderSwiper.on('slideChange', function () {
293
294        var currentSlide, slideType, player, command;
295
296        //find the current slide element and decide which player API we need to use.
297        currentSlide = $('.projectDetail-imgVideo-slider').find(".swiper-slide-active");
298
299        //determine which type of slide this, via a class on the slide container. This reads the second class, you could change this to get a data attribute or something similar if you don't want to use classes.
300        slideType = currentSlide.length ? currentSlide.attr("class").split(" ")[1] : null;
301
302        if (slideType == "mp4") {
303            currentSlide.find("video").get(0).pause();
304        }
305        else {
306            command = {
307                "event": "command",
308                "func": "pauseVideo"
309            };
310        }
311    });
312
313    $('#projectDetailFileFolderModal').on('shown.bs.modal', function () {
314        projectDetail_fileFolder_swiper = new Swiper('.projectDetail-fileFolder-slider .swiper-container', {
315            navigation: {
316                nextEl: '.projectDetail-fileFolder-slider .swiper-button-next',
317                prevEl: '.projectDetail-fileFolder-slider .swiper-button-prev',
318            },
319            slidesPerView: 1,
320            spaceBetween: 0,
321            breakpoints: {
322                320: {
323                    slidesPerView: 6,
324                },
325                768: {
326                    slidesPerView: 8
327                },
328                992: {
329                    slidesPerView: 10
330                },
331                1200: {
332                    slidesPerView: 15
333                }
334            }
335        });
336
337        fileFolder_detail_sliderSwiper = new Swiper(".fileFolder-detail-slider .swiper-container", {
338            loop: false,
339            spaceBetween: 0,
340            slidesPerView: 1,
341            navigation: {
342                nextEl: ".fileFolder-detail-slider .swiper-button-next",
343                prevEl: ".fileFolder-detail-slider .swiper-button-prev",
344            },
345            centeredSlides: true,
346            pagination: {
347                el: '.fileFolder-detail-slider .swiper-pagination',
348                type: 'fraction',
349                formatFractionCurrent: function (number) {
350                    return ('0' + number).slice(-2);
351                },
352                formatFractionTotal: function (number) {
353                    return ('0' + number).slice(-2);
354                },
355                renderFraction: function (currentClass, totalClass) {
356                    return '<span class="pagination-text"><span class="' + currentClass + '"></span>' +
357                        ' / ' +
358                        '<span class="' + totalClass + '"></span></span>';
359                }
360            },
361            on: {
362                init: function () {
363                    angular.element('button:eq(1)').scope().setDescription();
364                }
365            }
366        });
367
368
369        fileFolder_detail_sliderSwiper.on('slideChange', function () {
370
371            var currentSlide, slideType, player, command;
372
373            //find the current slide element and decide which player API we need to use.
374            currentSlide = $('.fileFolder-detail-slider').find(".swiper-slide-active");
375
376            //determine which type of slide this, via a class on the slide container. This reads the second class, you could change this to get a data attribute or something similar if you don't want to use classes.
377            angular.element('button:eq(1)').scope().setDescription(fileFolder_detail_sliderSwiper.realIndex);
378            slideType = currentSlide.length ? currentSlide.attr("class").split(" ")[1] : null;
379
380            if (slideType == "mp4") {
381                currentSlide.find("video").get(0).pause();
382            }
383            else {
384                command = {
385                    "event": "command",
386                    "func": "pauseVideo"
387                };
388            }
389        });
390    });
391}
392function goToLoginUrl() {
393    window.location = window.location.origin + '/user-login';
394}
395
396function toggleStickyModal(elementId, action) {
397    var modalInterval = setInterval(() => {
398        let $modal = $(`#${elementId}`);
399        let keyboard = false; // Prevent to close by ESC
400        let backdrop = 'static'; // Prevent to close on click outside the modal
401
402        if ($modal.length) {
403            if (typeof $modal.data('bs.modal') === 'undefined') { // Modal did not open yet
404                if (action == 'open') {
405                    $modal.modal({
406                        keyboard: keyboard,
407                        backdrop: backdrop
408                    });
409                }
410            } else {
411                if (action == 'open') {
412                    $modal.modal('show');
413                } else {
414                    $modal.modal('hide');
415                }
416            }
417
418            clearInterval(modalInterval);
419        }
420    }, 1000);
421}
422
423function homeFeaturedSliderInit() {
424    // featureSlide
425    new Swiper(".featureSlide", {
426        slidesPerView: 1,
427        spaceBetween: 20,
428        loop: true,
429        navigation: {
430            nextEl: '.featured-property-section .swiper-button-next',
431            prevEl: '.featured-property-section .swiper-button-prev',
432        },
433        breakpoints: {
434            320: {
435                slidesPerView: 1,
436            },
437            575: {
438                slidesPerView: 2,
439            },
440            768: {
441                slidesPerView: 3,
442            },
443            992: {
444                slidesPerView: 3,
445            },
446            1200: {
447                slidesPerView: 4,
448                spaceBetween: 18,
449            }
450        }
451    });
452}
453
454function homeAllProjectSliderInit() {
455    new Swiper(".listSlider", {
456        slidesPerView: 1,
457        spaceBetween: 20,
458        loop: true,
459        navigation: {
460            nextEl: '.our-development-section .swiper-button-next',
461            prevEl: '.our-development-section .swiper-button-prev',
462        },
463        breakpoints: {
464            320: {
465                slidesPerView: 1,
466            },
467            575: {
468                slidesPerView: 2,
469            },
470            768: {
471                slidesPerView: 3,
472            },
473            992: {
474                slidesPerView: 3,
475            },
476            1200: {
477                slidesPerView: 4,
478                spaceBetween: 18,
479            }
480        }
481    });
482}
483
484function homeNewsSliderInit() {
485    const newsSlider = new Swiper(".newsSlide", {
486        slidesPerView: 1,
487        spaceBetween: 30,
488        loop: true,
489        navigation: {
490            nextEl: '.real-estate-news-section .swiper-button-next',
491            prevEl: '.real-estate-news-section .swiper-button-prev',
492        },
493        breakpoints: {
494            320: {
495                slidesPerView: 1,
496                spaceBetween: 30,
497            },
498            768: {
499                slidesPerView: 2,
500                spaceBetween: 30,
501            },
502            992: {
503                slidesPerView: 2,
504                spaceBetween: 30,
505            },
506            1200: {
507                slidesPerView: 3,
508                spaceBetween: 50,
509            }
510        }
511    });
512}
513
514function homeBannerSliderInit() {
515    // bannerslider
516    new Swiper(".home-banner-slider1", {
517        slidesPerView: 1,
518        // Enable lazy loading
519        lazy: {
520            loadPrevNext: true, // Load images in the nearby slides
521        },
522        // Preload images to improve UX
523        preloadImages: false,
524        autoplay: {
525            delay: 5000,
526            disableOnInteraction: false,
527        },
528        on: {
529            lazyImageReady: function (swiperSlide, image) {
530                // Remove the placeholder image when the lazy-loaded image is ready
531                var placeholder = swiperSlide.querySelector('.swiper-image-placeholder');
532                if (placeholder) {
533                    placeholder.style.display = 'none';
534                }
535            },
536        },
537    });
538}
539
540
541function homeLogoSliderInit() {
542    const mySwiper = new Swiper(".logoslider", {
543        slidesPerView: 2,
544        spaceBetween: 30,
545        loop: true,
546        autoplay: {
547            delay: 500,
548            disableOnInteraction: true,
549        },
550        breakpoints: {
551            320: {
552                slidesPerView: 2,
553                spaceBetween: 30,
554            },
555            479: {
556                slidesPerView: 2,
557                spaceBetween: 30,
558            },
559            575: {
560                slidesPerView: 3,
561                spaceBetween: 30,
562            },
563            768: {
564                slidesPerView: 3,
565                spaceBetween: 30,
566            },
567            992: {
568                slidesPerView: 4,
569                spaceBetween: 30,
570            },
571            1200: {
572                slidesPerView: 4,
573                spaceBetween: 60,
574            }
575        }
576    });
577
578    jQuery('.logoslider').on('mouseover', function (e) {
579        mySwiper.autoplay.stop()
580    });
581
582    jQuery('.logoslider').on('mouseleave', function (e) {
583        mySwiper.autoplay.start()
584    });
585}
586
587
588/** Theme 7 **/
589$('.select-language').html($('.language-box li.select').html());
590
591$('.language-box li').on('click', function () {
592    $('.language-box ul').slideUp(20);
593});
594
595$('.select-language').on('click', function () {
596    $('.language-box ul').slideToggle(20);
597});
598
599// language box close
600$(document).mouseup(function (e) {
601    var container = $('.language-box'); //container
602    if (!container.is(e.target) && container.has(e.target).length === 0) {
603        $('.language-box ul').slideUp(20);
604    }
605});
606
607$('body').keydown(function (e) {
608    if (e.keyCode == 27) {
609        $('.language-box ul').slideUp(20);
610    }
611});
612
613function relatedPropertiesSlider() {
614    const relatedPropertiesSlider = new Swiper('.related-properties-slider', {
615        navigation: {
616            nextEl: '.related-properties-slider .swiper-button-next',
617            prevEl: '.related-properties-slider .swiper-button-prev',
618        },
619        slidesPerView: 1,
620        spaceBetween: 30,
621        breakpoints: {
622            320: {
623                slidesPerView: 1,
624            },
625            768: {
626                slidesPerView: 2
627            },
628            992: {
629                slidesPerView: 3
630            },
631            1200: {
632                slidesPerView: 4
633            }
634        }
635    });
636}

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.