1(async () => { 2 3 var UIElement = (function () { 4 var DOMElem = { 5 recentViewBtn: '#recent-views-button', 6 recentViewBtnClose: '#recent-views-close', 7 mobileMenuBtn: '#mobile-menu-btn', 8 slideDownBtn: '.button-slide-down', 9 modalContent: '.modal-popup', 10 browseEstateBtn: '#browseEstate', 11 bookWalkThroughBtn: '#bookWalkthrough', 12 homesDropDown: '.estate-items-holder .homes-holder', 13 navTabMenu: '.navTabMenuItem', 14 navTabContent: '.navTabContent', 15 grid: '.grid', 16 displayBox: '.display-homes-box', 17 buttonViewType: '.button-view-type', 18 cssSlider: '.css-slider', 19 goToTopMore: '.button-go-top' 20 }; 21 22 return { 23 getDOMElem: function () { 24 return DOMElem; 25 } 26 } 27 })(); 28 29 var UIController = (function ($, ui) { 30 var dom = ui.getDOMElem(); 31 32 var windowLoad = function () { 33 $(window).on('load', async function () { 34 let fullHash = window.location.hash 35 36 function activateContactFormByTrigger($trigger) { 37 if (!$trigger || !$trigger.length) { 38 return; 39 } 40 41 const target = $trigger.data('target'); 42 if (!target) { 43 return; 44 } 45 46 $('.contact-form-trigger.active').removeClass('active'); 47 $trigger.addClass('active'); 48 49 $('.contact-forms .contact-form.active').removeClass('active').hide(); 50 const $targetForm = $('#' + target); 51 if ($targetForm.length) { 52 $targetForm.addClass('active').show(); 53 } 54 } 55 56 function scrollToContactFormBlock() { 57 const $contactFormBlock = $('#contactFormBlock'); 58 if (!$contactFormBlock.length) { 59 return; 60 } 61 62 const offset = 100; 63 $('html, body').animate({ 64 scrollTop: $contactFormBlock.offset().top - offset, 65 }, 400); 66 } 67 68 const hashClass = fullHash.replace(/#/g, ""); 69 if (fullHash && /^[a-zA-Z0-9_-]+$/.test(hashClass) && $("." + hashClass).length) { 70 const $hashTrigger = $(`.contact-hash-event#${hashClass}, .contact-hash-event.${hashClass}`).first(); 71 activateContactFormByTrigger($hashTrigger); 72 scrollToContactFormBlock(); 73 window.setTimeout(scrollToContactFormBlock, 250); 74 } 75 else{ 76 //$('.contact-hash-event').first().click(); 77 } 78 79 }); 80 81 const urlParams = new URLSearchParams(window.location.search); 82 const blockID = urlParams.get('blockID'); 83 84 if (blockID) { 85 const targetClass = `.jump-${blockID}`; 86 const $target = $(targetClass); 87 88 if ($target.length) { 89 const isMobile = window.innerWidth <= 767; 90 const offset = isMobile ? 100 : 110; 91 const offsetTop = $target.offset().top - offset; 92 93 $('html, body').animate({ 94 scrollTop: offsetTop 95 }, 600); 96 } 97 } 98 99 if ($('.announcement-bar').hasClass('active')) { 100 $('header').addClass('withAnnouncementBar'); 101 } else { 102 $('header').removeClass('withAnnouncementBar'); 103 } 104 105 106 if ($('.homepage-video-overlay').length) { 107 setTimeout(function () { 108 $('.homepage-video-overlay').fadeOut(600); 109 }, 5000); 110 } 111 112 if (window.innerWidth > 767) { 113 $('.our-partner-content').matchHeight({ 114 byRow: true 115 }); 116 $('.facade-address').matchHeight({ 117 byRow: false 118 }); 119 $('.facade-title').matchHeight({ 120 byRow: false 121 }); 122 $('.virtualtour-address').matchHeight({ 123 byRow: false 124 }); 125 $('.virtualtour-title').matchHeight({ 126 byRow: false 127 }); 128 $('.office-location').matchHeight({ 129 byRow: false 130 }); 131 $('.mhb').matchHeight({ 132 byRow: false 133 }); 134 $('.news-item .image-holder').matchHeight({ 135 byRow: true 136 }); 137 $('.news-item .details .title').matchHeight({ 138 byRow: true 139 }); 140 $('.news-item .details .title').matchHeight({ 141 byRow: true 142 }); 143 } 144 145 $('.news-item .title').matchHeight({ 146 byRow: true, 147 property: 'height', 148 target: null, 149 remove: false 150 }); 151 152 const homedesignslisttabsfloorplantabcontenttabcontent = 153 $('.home-designs-list__tabs .floorplan-tab-content .tab-content'); 154 if (homedesignslisttabsfloorplantabcontenttabcontent.length) { 155 homedesignslisttabsfloorplantabcontenttabcontent.matchHeight({ 156 byRow: false, 157 property: 'height', 158 target: null, 159 remove: false 160 }); 161 } 162 const homedesignslisttabs = $('.home-designs-list__tabs'); 163 if (homedesignslisttabs.length) { 164 homedesignslisttabs.matchHeight({ 165 byRow: false, 166 property: 'height', 167 target: null, 168 remove: false 169 }); 170 } 171 172 $('.home-designs-list__item .home-designs-list__content .name-holder').matchHeight({ 173 byRow: true, 174 property: 'height', 175 target: null, 176 remove: false 177 }); 178 179 $('.home-designs-list__item .hal__address').matchHeight({ 180 byRow: false, 181 property: 'height', 182 target: null, 183 remove: false 184 }); 185 186 $('.display-centres-list-item .name').matchHeight({ 187 byRow: false, 188 property: 'height', 189 target: null, 190 remove: false 191 }); 192 $('.display-centres-list-item .info').matchHeight({ 193 byRow: false, 194 property: 'height', 195 target: null, 196 remove: false 197 }); 198 $('.display-centres-list-item .address-hours').matchHeight({ 199 byRow: false, 200 property: 'height', 201 target: null, 202 remove: false 203 }); 204 205 $('.display-centres-list-item .details-holder').matchHeight({ 206 byRow: false, 207 property: 'height', 208 target: null, 209 remove: false 210 }); 211 $('.display-homes-item .details-holder').matchHeight({ 212 byRow: false, 213 property: 'height', 214 target: null, 215 remove: false 216 }); 217 218 $('.display-homes-item .details-holder .info').matchHeight({ 219 byRow: false, 220 property: 'height', 221 target: null, 222 remove: false 223 }); 224 $('.display-homes-item .details-holder .address-hours').matchHeight({ 225 byRow: false, 226 property: 'height', 227 target: null, 228 remove: false 229 }); 230 231 if (window.innerWidth < 768) { 232 const $closeMapPreview = $('.close-map-preview'); 233 if ($closeMapPreview.length) { 234 $closeMapPreview.html('Open map').addClass('active'); 235 var mapBlock = $('.fullwidth-map-block'); 236 mapBlock.attr('style', 'display: none;'); 237 } 238 } 239 240 if (window.innerWidth > 767) { 241 $('.blog-list .blog-list-item').matchHeight({ 242 byRow: true 243 }); 244 } 245 246 247 $('.favourites__tabs .floorplan-svg').matchHeight({ 248 byRow: true, 249 property: 'height', 250 target: null, 251 remove: false 252 }); 253 $('.favourites__tabs .room-demensions-block').matchHeight({ 254 byRow: false, 255 property: 'height', 256 target: null, 257 remove: false 258 }); 259 $('.favourites__tabs .block-demensions-block').matchHeight({ 260 byRow: false, 261 property: 'height', 262 target: null, 263 remove: false 264 }); 265 $('.favourites__tabs .floorplan-demensions-block').matchHeight({ 266 byRow: false, 267 property: 'height', 268 target: null, 269 remove: false 270 }); 271 $('.home-designs-list__item .hal__address').matchHeight({ 272 byRow: false, 273 property: 'height', 274 target: null, 275 remove: false 276 }); 277 }; 278 279 var windowScroll = function () { 280 $(window).on('scroll', function () { 281 initStickyFilter(); 282 initStickyHeader(); 283 284 var scrollPositionCta = window.scrollY; 285 var ctaContainer = $('.floatingCta'); 286 if (ctaContainer.length) { 287 var showCtaContainer = document.getElementById('showFloating
287Cta'); 288 289 if (scrollPositionCta >= showCtaContainer.offsetTop) { 290 ctaContainer.addClass("active"); 291 } else { 292 ctaContainer.removeClass("active"); 293 } 294 } 295 }) 296 } 297 298 var onWindowResize = function () { 299 $(window).on('resize', function () { 300 301 }) 302 }; 303 304 var slickSlider = function (elem, options) { 305 $(elem).slick(options) 306 }; 307 var unslickSlider = function (elem) { 308 const $elem = $(elem); 309 if ($elem.hasClass('slick-initialized')) { 310 $elem.slick('unslick'); 311 } 312 }; 313 314 var chosenSelect = function (elem) { 315 const $elem = $(elem); 316 if (!$elem.length) { 317 return; 318 } 319 320 const initChosen = function () { 321 $elem.chosen({ 322 disable_search_threshold: 10, 323 search_contains: true 324 }); 325 326 setTimeout(function () { 327 if ($('.mapSearchBlock input[type="text"]').length) { 328 $('.mapSearchBlock input[type="text"]').on('keyup', function () { 329 if ($(this).val().length) { 330 $('.mapSearchBlock').addClass('active'); 331 } else { 332 $('.mapSearchBlock').removeClass('active'); 333 } 334 }); 335 } 336 }, 1000); 337 }; 338 339 if ('requestIdleCallback' in window) { 340 requestIdleCallback(initChosen, { timeout: 2000 }); 341 return; 342 } 343 344 window.addEventListener('load', function () { 345 setTimeout(initChosen, 500); 346 }, { once: true }); 347 } 348 349 var sameHeight = function (elem) { 350 if (window.innerWidth > 767) { 351 $(elem).matchHeight({ 352 byRow: false 353 }); 354 } 355 }; 356 357 var sameHeightByRow = function (elem) { 358 $(elem).matchHeight({ 359 byRow: true 360 }); 361 }; 362 363 var modalFade = function (elem, callback, json) { 364 const $elem = $(elem); 365 $elem.modal({ 366 fadeDuration: 200 367 }); 368 if (typeof callback == 'function') { 369 callback($elem, json); 370 } 371 }; 372 373 //Click Events 374 var clickEvents = function () { 375 const stickyHeader = $('#stickyHeader'); 376 $('.js-hide-announcement').on('click', function (e) { 377 e.preventDefault(); 378 $('.announcement-bar').removeClass('active'); 379 $('header').removeClass('withAnnouncementBar'); 380 }); 381 382 $(document).on('click', '.js-scroll-to-form', function (e) { 383 const form = $('.forms-block').first(); 384 if (!form.length) { 385 return; 386 } 387 $('html, body').animate({ 388 scrollTop: form.offset().top - (stickyHeader.outerHeight() || 0) 389 }); 390 e.preventDefault(); 391 }); 392 393 window.addEventListener('click', function (e) { 394 document.querySelectorAll('.dropdown').forEach(function (dropdown) { 395 if (!dropdown.contains(e.target)) { 396 // Click was outside the dropdown, close it 397 dropdown.open = false; 398 } 399 }); 400 }); 401 $('.contact-form-trigger').on('click', function () { 402 var target = $(this).data('target'); 403 var trigger = $(this); 404 var time = 0; 405 if (trigger.hasClass('active')) { 406 trigger.removeClass('active'); 407 $('#' + target).removeClass('active').slideUp(); 408 } else { 409 if ($('.contact-forms .contact-form.active').length) { 410 time = 500; 411 } 412 $('.contact-forms .contact-form.active').removeClass('active').slideUp(); 413 $('.contact-form-trigger.active').removeClass('active'); 414 setTimeout(function () { 415 trigger.toggleClass('active'); 416 $('#' + target).addClass('active').slideDown(); 417 }, time); 418 } 419 }); 420 421 $('.recently-viewed .trigger').on('click', function () { 422 $(this).toggleClass('active');
423 $('.sub-menu-holder').removeClass('active'); 424 $('header').toggleClass('recently-viewed-open'); 425 $('.recently-viewed-holder').slideToggle(); 426 }); 427 428 $('.recently-viewed-holder .close').on('click', function () { 429 $('header').toggleClass('recently-viewed-open'); 430 $('.recently-viewed-holder').slideToggle(); 431 }); 432 433 $('.js-star:not(.favourites-toggle-button):not(.scale-75)').on('click', function (e) { 434 e.preventDefault(); 435 $(this).toggleClass('active'); 436 }); 437 438 $('.js-show-response').on('click', function (e) { 439 e.preventDefault(); 440 $('.modal-content.form-content').addClass('hide'); 441 $('.modal-content.thankyou-content').removeClass('hide'); 442 }); 443 444 $('.js-close-enquire-modal').on('click', function (e) { 445 e.preventDefault(); 446 $('.modal-close').click() 447 }); 448 449 $('.show-enquire-modal').on('click', function (e) { 450 e.preventDefault(); 451 $('#enquire_modal .modal-content.form-content').removeClass('hide'); 452 $('#enquire_modal .modal-content.thankyou-content').addClass('hide'); 453 }); 454 455 $('.show-display-homes-modal').on('click', function (e) { 456 e.preventDefault(); 457 $('#display_homes_modal .modal-content.form-content').removeClass('hide'); 458 $('#display_homes_modal .modal-content.thankyou-content').addClass('hide'); 459 }); 460 461 $('.enquire-form button').on('click', function (e) { 462 e.preventDefault(); 463 $('.enquire-form').addClass('hide'); 464 $('.enquire-form-response').removeClass('hide'); 465 }); 466 467 $('.enquire-side-bar-holder').click(function (event) { 468 if (event.target.className === 'enquire-side-bar-holder active') { 469 $('.enquire-side-bar-holder').removeClass('active'); 470 $("html, body").removeClass('no-scroll'); 471 $("html, body").removeClass('with-overlay'); 472 } 473 }) 474 475 $('.enquire-side-bar .close-side-bar img').on('click', function () { 476 $('.enquire-side-bar-holder').removeClass('active'); 477 $("html, body").removeClass('no-scroll'); 478 $("html, body").removeClass('with-overlay'); 479 }); 480 481 $('.open-side-bar').on('click', function () { 482 $('.enquire-form').removeClass('hide'); 483 $('.enquire-form-response').addClass('hide'); 484 $('.enquire-side-bar-holder').addClass('active'); 485 $("html, body").addClass('no-scroll'); 486 $("html, body").addClass('with-overlay'); 487 }); 488 489 const $floorPlanTabControl = $('.floorplan-tab-control:not(.style-only)'); 490 if ($floorPlanTabControl.length) { 491 initHomeDesignsFacadeSlider(); 492 $floorPlanTabControl.find('.tab-control').on('click', function (e) { 493 e.preventDefault(); 494 var target = $(this).data('target'); 495 $(this).parent('.floorplan-tab-control').find('.tab-control').removeClass('active'); 496 $(this).parent('.floorplan-tab-control').next('.floorplan-tab-content').find('.tab-content').removeClass('active'); 497 $(this).addClass('active'); 498 $(this).parent('.floorplan-tab-control').next('.floorplan-tab-content').find('#' + target).addClass('active'); 499 initHomeDesignsFacadeSlider(); 500 }); 501 } 502 503 $('.tabset .tab-controls label').each((index, element) => { 504 const $this = $(element); 505 const tabState = { 506 disabled: false 507 }; 508 $this.on('click', function (e) { 509 e.preventDefault(); 510 if (tabState.disabled) { 511 return; 512 } 513 var target = $this.data('target');
514 $('.tabset .tab-controls label').removeClass('active'); 515 $('.tab-panels section').removeClass('active'); 516 $this.addClass('active'); 517 const $targetTabPanel = $('.tab-panels #' + target); 518 $targetTabPanel.addClass('active'); 519 $targetTabPanel.get(0).dispatchEvent(new CustomEvent('tabShown', { 520 detail: { tabState } 521 })); 522 523 if ($('.dh-tabset').length) { 524 $targetTabPanel.find('.dh-tab-control').removeClass('active'); 525 $targetTabPanel.find('.dh-tab-panel').removeClass('active'); 526 $targetTabPanel.find('.dh-tab-control:first-child').addClass('active'); 527 $targetTabPanel.find('.dh-tab-panel:first-child').addClass('active'); 528 529 if (window.innerWidth < 1024) { 530 $('.dh-tabset .dh-tab-controls').slick({ 531 adaptiveHeight: true, 532 variableWidth: true, 533 slidesToScroll: 1, 534 swipe: true, 535 infinite: false, 536 swipeToSlide: true, 537 dots: false, 538 arrows: false 539 }); 540 } 541 } 542 }); 543 }); 544 545 $('.home-designs-list__tabs .tab-item').on('click', function (e) { 546 e.preventDefault(); 547 var target = $(this).data('target'); 548 $(this).parent('.tab-list').find('.tab-item').removeClass('active'); 549 $(this).parent('.tab-list').parent('.home-designs-list__tabs').find('.tab-item-content').removeClass('active'); 550 $(this).addClass('active'); 551 $(this).parent('.tab-list').parent('.home-designs-list__tabs').find('.tab-item-content.' + target).addClass('active'); 552 initFacadeSlider(); 553 initHomeDesignsFacadeSlider(); 554 }); 555 556 $('.favourites__tabs:not(.style-only) .tab-item').on('click', function (e) { 557 e.preventDefault(); 558 var target = $(this).data('target'); 559 $(this).parent('.tab-list').find('.tab-item').removeClass('active'); 560 $(this).parent('.tab-list').parent('.favourites__tabs').find('.tab-item-content').removeClass('active'); 561 $(this).addClass('active'); 562 $(this).parent('.tab-list').parent('.favourites__tabs').find('.tab-item-content.' + target).addClass('active'); 563 initFacadeSlider(); 564 initHomeDesignsFacadeSlider(); 565 }); 566 567 // menu 568 $headerWithSubmenu = $('header .header-bottom .links .with-submenu'); 569 $headerWithSubmenu.on('mouseover', function () { 570 $(this).addClass('active'); 571 $(".main-holder").addClass('submenu-overlay'); 572 $(".footer-holder").addClass('submenu-overlay'); 573 }); 574 $headerWithSubmenu.on('mouseout', function () { 575 $(this).removeClass('active'); 576 $(".main-holder").removeClass('submenu-overlay'); 577 $(".footer-holder").removeClass('submenu-overlay'); 578 }); 579 580 $('.main-menu.with-sub-menu .main-link').on('click', function (e) { 581 e.preventDefault(); 582 $(this).parent('.with-sub-menu').toggleClass('active'); 583 $(this).next('.sub-menu').slideToggle(); 584 }); 585 586 const sideBarMenu = document.getElementById('sidebar-menu') 587 if (sideBarMenu) { 588 sideBarMenu.addEventListener('change', (event) => { 589 $("html, body").toggleClass('no-scroll'); 590 }) 591 } 592 593 const $rangeItem = $('.range-item:not(.hb-filter-checkbox)'); 594 if ($rangeItem.length) { 595 $rangeItem.on('click', function () { 596 $(this).toggleClass('active'); 597 }); 598 } 599 600 $('.js-toggle-filter').on('click', function () { 601 $(this).toggleClass('active'); 602 $('.bottom-filter').slideToggle(); 603 }); 604 605 $('.js-toggle-filter-mobile').on('click', function () { 606 $('.mobile-filter').slideToggle(); 607 }); 608 609 $('.js-toggle-filter-mobile-1').on('click', function () { 610 $('.mobile-filter').slideToggle(); 611 $('.js-toggle-mobile-filter').toggleClass('active'); 612 }); 613 614 $('.js-toggle-mobile-filter').on('click', function () { 615 $(this).toggleClass('active'); 616 $('.mobile-home-filter').toggleClass('active'); 617 $('.mobile-filter').slideToggle(); 618 }); 619 620 $('.close-home-preview').on('click', function () { 621 var preview = $(this).parent('.col-span-12').parent('.row').parent('.col-span-12').parent('.home-preview').parent('.home-preview-holder').parent('.home-designs-preview'); 622 // preview.toggleClass('active'); 623 // // $(this).parent('.column').parent('.floorplan-blocks').parent('.column').parent('.row').parent('.home-preview-holder').parent('.home-designs-preview').slideToggle(); 624 // preview.find('.js-toggle-preview').removeClass('disabled'); 625 var time = 0; 626 $('.home-designs-preview').css('min-height', '0'); 627 if (preview.hasClass('active')) { 628 preview.removeClass('active'); 629 } else { 630 if ($('.home-designs-preview.active').length) { 631 time = 500; 632 } 633 $('.home-designs-preview.active').removeClass('active'); 634 $('.js-toggle-preview').removeClass('disabled'); 635 setTimeout(function () { 636 preview.toggleClass('active'); 637 var minHValue = '912px'; 638 if (window.innerWidth < 768) { 639 minHValue = '360px'; 640 } 641 $('.home-designs-preview.active').css('min-height', minHValue); 642 $(this).addClass('disabled') 643 setTimeout(function () { 644 var dataTarget = $('.home-designs-preview.active') 645 var floatingHeader = 0; 646 if (window.innerWidth < 1200) { 647 floatingHeader = 107; 648 } 649 $('html, body').animate({ 650 scrollTop: $(dataTarget).offset().top - floatingHeader 651 }, 500); 652 var previewHeight = $('.home-designs-preview.active .home-preview').height(); 653 $('.home-designs-preview.active').css('min-height', previewHeight + 'px'); 654 }, 1000); 655 }, time); 656 } 657 }); 658
659 $('.close-facade-preview').on('click', function () { 660 var preview = $(this).parent('.col-span-6').parent('.row').parent('.fullwidth-col').parent('.row').parent('.col-span-12').parent('.home-preview').parent('.home-preview-holder').parent('.home-designs-preview'); 661 preview.toggleClass('active'); 662 preview.find('.js-toggle-preview').removeClass('disabled'); 663 $('.home-designs-preview').css('min-height', '0'); 664 }); 665 666 $('.close-map-preview').on('click', function () { 667 var mapBlock = $('.fullwidth-map-block'); 668 mapBlock.slideToggle(); 669 var text = "Open map"; 670 if ($(this).hasClass('active')) { 671 text = "Close map"; 672 } 673 $(this).html(text).toggleClass('active'); 674 }); 675 676 $('.js-toggle-preview').on('click', function (e) { 677 // if (window.innerWidth > 1023) { 678 e.preventDefault(); 679 var preview = $(this).parent('.home-designs-list__actions').parent('.home-designs-list__item').next('.home-designs-preview'); 680 var time = 0; 681 $('.home-designs-preview').css('min-height', '0'); 682 if (preview.hasClass('active')) { 683 preview.removeClass('active'); 684 } else { 685 if ($('.home-designs-preview.active').length) { 686 time = 500; 687 } 688 $('.home-designs-preview.active').removeClass('active'); 689 $('.js-toggle-preview').removeClass('disabled'); 690 setTimeout(function () { 691 preview.toggleClass('active'); 692 var minHValue = '912px'; 693 if (window.innerWidth < 768) { 694 minHValue = '360px'; 695 } 696 $('.home-designs-preview.active').css('min-height', minHValue); 697 $(this).addClass('disabled') 698 setTimeout(function () { 699 var dataTarget = $('.home-designs-preview.active') 700 var floatingHeader = 0; 701 if (window.innerWidth < 1200) { 702 floatingHeader = 107; 703 } 704 $('html, body').animate({ 705 scrollTop: $(dataTarget).offset().top - floatingHeader 706 }, 500); 707 var previewHeight = $('.home-designs-preview.active .home-preview').height(); 708 $('.home-designs-preview.active').css('min-height', previewHeight + 'px'); 709 }, 1000); 710 }, time); 711 } 712 // } 713 }); 714 715 716 $(".anchor-to-link").click(function (e) { 717 e.preventDefault(); 718 var dataTarget = $(this).data('target'); 719 $('html, body').animate({ 720 scrollTop: $("#" + dataTarget).offset().top 721 }, 1000); 722 }); 723 724 $(".additional-features .item").on("click", function (e) { 725 e.preventDefault(); 726 727 if ($(this).hasClass("active")) { 728 $(this).removeClass("active"); 729 // Reset background and text color 730 $(this).css({ 731 "background-color": "transparent", // or your default color 732 "color": "rgb(1, 22, 56)" // or your default text color 733 }); 734 } else { 735 $(this).addClass("active"); 736 // Optionally re-apply the active colors 737 $(this).css({ 738 "background-color": "rgb(1 22 56 / var(--tw-bg-opacity))", 739 "color": "rgb(255 255 255 / var(--tw-text-opacity))" 740 }); 741 } 742 }); 743 744
745 $('.dh-tabset .dh-tab-controls .dh-tab-control').on('click', function (e) { 746 e.preventDefault(); 747 var target = $(this).data('target'); 748 if (window.innerWidth < 1024) { 749 $(this).parent('.slick-track').parent('.slick-list').parent('.dh-tab-controls').parent('.dh-tabset').find('.dh-tab-control').removeClass('active'); 750 $(this).parent('.slick-track').parent('.slick-list').parent('.dh-tab-controls').parent('.dh-tabset').find('.dh-tab-panel').removeClass('active'); 751 $(this).addClass('active'); 752 $(this).parent('.slick-track').parent('.slick-list').parent('.dh-tab-controls').parent('.dh-tabset').find('.dh-tab-panel#' + target).addClass('active'); 753 } else { 754 $(this).parent('.dh-tab-controls').parent('.dh-tabset').find('.dh-tab-control').removeClass('active'); 755 $(this).parent('.dh-tab-controls').parent('.dh-tabset').find('.dh-tab-panel').removeClass('active'); 756 $(this).addClass('active'); 757 $(this).parent('.dh-tab-controls').parent('.dh-tabset').find('.dh-tab-panel#' + target).addClass('active'); 758 } 759 }); 760 761 762 763 764 if ($('.play-video-btn').length) { 765function initVimeoScrollAutoplay() {
766 var $videoWrappers = $(".vimeo-wrapper[data-video-id]"); 767 768 if ($videoWrappers.length === 0) return; 769 770 // Sort wrappers by vertical position (top to bottom) 771 $videoWrappers = $videoWrappers.sort(function (a, b) { 772 return $(a).offset().top - $(b).offset().top; 773 }); 774 775 var observerOptions = { 776 root: null, 777 rootMargin: "0px", 778 threshold: 0, // trigger when any part enters viewport 779 }; 780 781 var observer = new IntersectionObserver(function (entries) { 782 var stickyHeaderOffset = window.innerWidth > 767 ? 200 : 0; 783 var prePlayOffset = 500; 784 var scrollTop = $(window).scrollTop(); 785 var viewportTop = scrollTop + stickyHeaderOffset; 786 var viewportBottom = scrollTop + $(window).height(); 787 var prePlayBottom = viewportBottom + prePlayOffset; 788 789 // Play the first video whose top is in the viewport 790 for (var i = 0; i < $videoWrappers.length; i++) { 791 var $wrapper = $($videoWrappers[i]); 792 var top = $wrapper.offset().top; 793 var bottom = top + $wrapper.outerHeight(); 794 795 // Start autoplay slightly before the wrapper reaches the top viewport area. 796 if (bottom > viewportTop && top < prePlayBottom && $wrapper.find("iframe").length === 0) { 797 var videoId = $wrapper.data("video-id"); 798 var $thumbnail = $wrapper.find(".video-thumbnail"); 799 if (!videoId) continue; 800 801 // Calculate aspect ratio 802 var thumb = $thumbnail[0]; 803 var aspectRatio = thumb.naturalHeight / thumb.naturalWidth; 804 var wrapperWidth = $wrapper.width(); 805 $wrapper.css({ 806 position: "relative", 807 height: wrapperWidth * aspectRatio + "px", 808 }); 809 810 var $iframe = $('<iframe>', { 811 src: videoId + "?autoplay=1&muted=1&playsinline=1", 812 frameborder: 0, 813 allow: "autoplay; fullscreen; picture-in-picture", 814 allowfullscreen: true, 815 css: { 816 position: "absolute", 817 top: 0, 818 left: 0, 819 width: "100%", 820 height: "100%", 821 }, 822 }); 823 824 $wrapper.empty().append($iframe); 825 break; // stop after the first visible video 826 } 827 } 828 }, observerOptions); 829 830 $videoWrappers.each(function () { 831 observer.observe(this); 832 }); 833 834 // Maintain aspect ratio on resize 835 $(window).on("resize", function () { 836 $videoWrappers.each(function () { 837 var $wrapper = $(this); 838 var $iframe = $wrapper.find("iframe"); 839 var $thumb = $wrapper.find(".video-thumbnail"); 840 841 if ($iframe.length && $thumb.length) { 842 var aspectRatio = $thumb[0].naturalHeight / $thumb[0].naturalWidth; 843 var wrapperWidth = $wrapper.width(); 844 $wrapper.css("height", wrapperWidth * aspectRatio + "px"); 845 } 846 }); 847 }); 848} 849 850 initVimeoScrollAutoplay(); 851 852 $(".play-video-btn").on("click", function (e) { 853 e.preventDefault(); 854 855 var $button = $(this); 856 var $wrapper = $button.closest(".vimeo-wrapper, [data-video-id]"); 857 var $thumbnail = $wrapper.find(".video-thumbnail"); 858 var videoId = $wrapper.data("video-id"); 859 860 if (!videoId) return; 861 862 // Get natural width/height of thumbnail 863 var thumb = $thumbnail[0]; 864 var aspectRatio = thumb.naturalHeight / thumb.naturalWidth; 865 866 // Set wrapper height dynamically 867 var wrapperWidth = $wrapper.width(); 868 $wrapper.css({ 869 position: "relative", 870 height: wrapperWidth * aspectRatio + "px", 871 }); 872 873 // Create iframe 874 var $iframe = $('<iframe>', { 875 src: videoId, 876 frameborder: 0, 877 allow: "autoplay; fullscreen; picture-in-picture", 878 allowfullscreen: true, 879 css: { 880 position: "absolute", 881 top: 0, 882 left: 0, 883 width: "100%", 884 height: "100%", 885 }, 886 }); 887 888 // Replace thumbnail and button 889 $wrapper.empty().append($iframe); 890 }); 891 892 // Optional: handle resize 893 $(window).on("resize", function () { 894 $(".vimeo-wrapper iframe").each(function () { 895 var $iframe = $(this); 896 var $wrapper = $iframe.parent(); 897 var $thumb = $wrapper.find(".video-thumbnail"); 898 899 if ($thumb.length === 0) return; 900 901 var aspectRatio = $thumb[0].naturalHeight / $thumb[0].naturalWi
901dth; 902 var wrapperWidth = $wrapper.width(); 903 $wrapper.css("height", wrapperWidth * aspectRatio + "px"); 904 }); 905 }); 906 } 907 } 908 909 var initflexSlider = function () { 910 // $('.flex-slider .flex-slider-item').on('click', function () { 911 // $('.flex-slider .flex-slider-item').removeClass('active'); 912 // $(this).toggleClass('active'); 913 // }); 914 $('.flex-slider ul li').on('click', function (e) { 915 var target = $(this).data('target'); 916 if ($(this).hasClass('active')) { 917 e.preventDefault(); 918 location.href = target; 919 } 920 $('.flex-slider ul li').removeClass('active'); 921 $(this).toggleClass('active'); 922 }); 923 } 924 925 var videoEvents = function () { 926 if ($('.js-play-video').length) { 927 $('html').on('click', '.js-play-video', function () { 928 var vimeoHeight, vimeoWidth; 929 vimeoHeight = $(this).outerHeight(); 930 vimeoWidth = $(this).outerWidth(); 931 932 $('.trailer-image img').hide(); 933 934 var $iframe = $('<iframe />', { 935 src: 'https://www.youtube.com/embed/fla02yFATuY?autoplay=1&rel=0&modestbranding=1&autohide=1&showinfo=0&controls=0', 936 class: 'vimeo', 937 frameborder: 0 938 }) 939 940 $iframe.attr('width', vimeoWidth).attr('height', vimeoHeight); 941 942 $(this).parent().removeClass('video'); 943 $(this).replaceWith($iframe); 944 945 if ($('.trailer-text').length) { 946 $('.trailer-text').hide(); 947 } 948 949 }); 950 } 951 } 952 953 //Unite 954 var unitegallery = function (id) { 955 var $id = $(id); 956 if ($id.length) { 957 var galleryOptions = { 958 gallery_theme: "tiles", 959 tiles_col_width: 370, 960 tiles_align: "center", 961 tiles_exact_width: false, 962 tiles_space_between_cols: 30, 963 tiles_space_between_cols_mobile: 30, 964 tiles_include_padding: false, 965 tiles_min_columns: 1, 966 tiles_max_columns: 4, 967 tile_enable_border: false, 968 tile_enable_outline: false, 969 tile_enable_shadow: false, 970 tile_width: 370, 971 tile_height: 155, 972 theme_gallery_padding: 0, 973 lightbox_type: "compact", 974 lightbox_overlay_opacity: 0.85, 975 lightbox_slider_image_shadow: false, 976 lightbox_arrows_position: "inside", 977 lightbox_slider_image_border: false, 978 lightbox_slider_image_border_width: 20, 979 lightbox_slider_image_border_color: "transparent", 980 lightbox_arrows_inside_alwayson: true, 981 tiles_align: "left", 982 } 983 var galleryFacade = $id.unitegallery(galleryOptions); 984 var galleryFacadeCaption = $id.next('.gallery-details').find('.caption'); 985 var galleryFacadeTotal = $id.next('.gallery-details').find('.counter .total'); 986 var galleryFacadeCurrent = $id.next('.gallery-details').find('.counter .current-num'); 987 988 $('.ug-thumb-wrapper,.ug-thumb-image,.ug-thumb-overlay').addClass('aos-item').attr('data-aos', 'fade-in').attr('data-aos-duration', '800'); 989 initAnimation(); 990 galleryFacadeTotal.html(galleryFacade.getNumItems()); 991 galleryFacade.on("item_change", function (num, data) { 992 galleryFacadeCaption.html(data.description); 993 galleryFacadeCurrent.html(num + 1); 994 }); 995 } 996 } 997 998 //Isotope 999 var isotopeInit = function (elem) { 1000 if ($(elem).length) { 1001 var options = { 1002 itemSelector: '.column', 1003 layoutMode: 'masonry', //masonry 1004 percentPosition: true, 1005 }; 1006 1007 $(elem).each(function () { 1008 var self = $(this); 1009 if (typeof $(this).imagesLoaded == 'function') { 1010 $(this).imagesLoaded(function (instance) { 1011 if (instance.isComplete) { 1012 self.isotope(options); 1013 } 1014 }); 1015 } 1016 }) 1017 } 1018 }; 1019 1020 var initAnimation = function () { 1021 if ($('.aos-item').length) { 1022 AOS.init({ 1023 easing: 'ease-in-out-sine' 1024 }); 1025 } 1026 }; 1027 1028 var initStickyNav = function () { 1029 if ($('.about-nav a').length) { 1030 var navHeight = 90; 1031 if (window.innerWidth < 767) { 1032 navHeight = 60; 1033 } 1034 $(".about-nav a").click(function (e) { 1035 e.preventDefault(); 1036 var dataTarget = $(this).data('target'); 1037 $('.about-nav a').removeClass('active'); 1038 $(this).addClass('active'); 1039 $('html, body').animate({ 1040 scrollTop: $("." + dataTarget).offset().top - navHeight 1041 }, 1000); 1042 }); 1043 } 1044 1045 if ($('.cast-nav a').length) { 1046 var navHeight = 160; 1047 if (window.innerWidth < 767) { 1048 navHeight = 100; 1049 } 1050 $(".cast-nav a").click(function (e) { 1051 e.preventDefault(); 1052 $('.cast-nav a').removeClass('active'); 1053 $(this).addClass('active'); 1054 $('.cast-crew-block').addClass('hide'); 1055 var dataTarget = $(this).data('target'); 1056 $("." + dataTarget).removeClass('hide'); 1057 $('html, body').animate({ 1058 scrollTop: $("." + dataTarget).offset().top - navHeight 1059 }, 1000); 1060 }); 1061 } 1062 1063 if ($('#sticky-nav').length) { 1064 window.onscroll = function () { stickyNav() }; 1065 1066 var navbar = document.getElementById("sticky-nav"); 1067 var sticky = navbar.offsetTop; 1068 1069 function stickyNav() { 1070 if (window.pageYOffset >= sticky) { 1071 navbar.classList.add("sticky") 1072 } else { 1073 navbar.classList.remove("sticky"); 1074 } 1075 1076 if ($('.about-nav').length) { 1077 let mainNavLinks = document.querySelectorAll("#sticky-nav ul li a"); 1078 1079 let fromTop = window.scrollY; 1080 var headerHeight = 360; 1081 if (window.innerWidth < 1024) { 1082 headerHeight = 150; 1083 } 1084 1085 mainNavLinks.forEach(link => { 1086 let section = document.querySelector(link.hash); 1087 if ( 1088 section.offsetTop + headerHeight <= fromTop && 1089 section.offsetTop + headerHeight + section.offsetHeight > fromTop 1090 ) { 1091 link.classList.add("active"); 1092 } else { 1093 link.classList.remove("active"); 1094 } 1095 }); 1096 } 1097 } 1098 } 1099 } 1100 1101 var initPhotoSwipeFromDOM = function (gallerySelector) { 1102 1103 // parse slide data (url, title, size ...) from DOM elements 1104 // (children of gallerySelector) 1105 var parseThumbnailElements = function (el) { 1106 var thumbElements = el.childNodes, 1107 numNodes = thumbElements.length, 1108 items = [], 1109 figureEl, 1110 linkEl, 1111 size, 1112 item; 1113 1114 for (var i = 0; i < numNodes; i++) { 1115 1116 figureEl = thumbElements[i]; // <figure> element 1117 1118 // include only element nodes 1119 if (figureEl.nodeType !== 1) { 1120 continue; 1121 } 1122 1123 1124 1125 if (figureEl.className.indexOf('slick-cloned') > 0) { 1126 continue; 1127 } 1128 1129 1130 linkEl = figureEl.children[0]; // <a> element 1131 1132 size = linkEl.getAttribute('data-size').split('x'); 1133 1134 var j_width = $(window).width(); 1135 var j_height = $(window).height(); 1136 size = [j_width, j_height] 1137 1138 // create slide object 1139 item = { 1140 src: linkEl.getAttribute('href'), 1141 w: parseInt(size[0], 10), 1142 h: parseInt(size[1], 10) 1143 }; 1144 1145 1146 1147 if (figureEl.children.length > 1) { 1148 // <figcaption> content 1149 item.title = figureEl.children[1].innerHTML; 1150 } 1151 1152 if (linkEl.children.length > 0) { 1153 // <img> thumbnail element, retrieving thumbnail url 1154 item.msrc = linkEl.children[0].getAttribute('src'); 1155 } 1156 1157 item.el = figureEl; // save link to element for getThumbBoundsFn 1158 items.push(item); 1159 } 1160 1161 // console.log(items); 1162 return items; 1163 }; 1164 1165 // find nearest parent element 1166 var closest = function closest(el, fn) { 1167 return el && (fn(el) ? el : closest(el.parentNode, fn)); 1168 }; 1169 1170 // triggers when user clicks on thumbnail 1171 var onThumbnailsClick = function (e) { 1172 e = e || window.event; 1173 e.preventDefault ? e.preventDefault() : e.returnValue = false;
1174 1175 var eTarget = e.target || e.srcElement; 1176 1177 // find root element of slide 1178 var clickedListItem = closest(eTarget, function (el) { 1179 return (el.tagName && el.tagName.toUpperCase() === 'FIGURE'); 1180 }); 1181 1182 if (!clickedListItem) { 1183 return; 1184 } 1185 1186 // find index of clicked item by looping through all child nodes 1187 // alternatively, you may define index via data- attribute 1188 var clickedGallery = clickedListItem.parentNode, 1189 childNodes = clickedListItem.parentNode.childNodes, 1190 numChildNodes = childNodes.length, 1191 nodeIndex = 0, 1192 index; 1193 1194 for (var i = 0; i < numChildNodes; i++) { 1195 if (childNodes[i].nodeType !== 1) { 1196 continue; 1197 } 1198 1199 if (childNodes[i] === clickedListItem) { 1200 index = nodeIndex; 1201 break; 1202 } 1203 nodeIndex++; 1204 } 1205 1206 1207 if (index >= 0) { 1208 // open PhotoSwipe if valid index found 1209 openPhotoSwipe(index, clickedGallery); 1210 } 1211 return false; 1212 }; 1213 1214 // parse picture index and gallery index from URL (#&pid=1&gid=2) 1215 var photoswipeParseHash = function () { 1216 var hash = window.location.hash.substring(1), 1217 params = {}; 1218 1219 if (hash.length < 5) { 1220 return params; 1221 } 1222 1223 var vars = hash.split('&'); 1224 for (var i = 0; i < vars.length; i++) { 1225 if (!vars[i]) { 1226 continue; 1227 } 1228 var pair = vars[i].split('='); 1229 if (pair.length < 2) { 1230 continue; 1231 } 1232 params[pair[0]] = pair[1]; 1233 } 1234 1235 if (params.gid) { 1236 params.gid = parseInt(params.gid, 10); 1237 } 1238 1239 return params; 1240 }; 1241 var openPhotoSwipe = function (index, galleryElement, disableAnimation, fromURL) { 1242 $('body').addClass('photoSwipeOpen'); 1243 var pswpElement = document.querySelectorAll('.pswp')[0], 1244 gallery, 1245 options, 1246 items; 1247 1248 items = parseThumbnailElements(galleryElement); 1249 1250 index -= 1; 1251 // console.log(index); 1252 1253 // define options (if needed) 1254 options = { 1255 1256 // define gallery index (for URL) 1257 galleryUID: galleryElement.getAttribute('data-pswp-uid'), 1258 initialZoomLevel: 'fill', 1259 getThumbBoundsFn: function (index) { 1260 // See Options -> getThumbBoundsFn section of documentation for more info 1261 var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail 1262 pageYScroll = window.pageYOffset || document.documentElement.scrollTop, 1263 rect = thumbnail.getBoundingClientRect(); 1264 1265 return { x: rect.left, y: rect.top + pageYScroll, w: rect.width }; 1266 } 1267 1268 }; 1269 1270 // PhotoSwipe opened from URL 1271 if (fromURL) { 1272 if (options.galleryPIDs) { 1273 // parse real index when custom PIDs are used 1274 // http://photoswipe.com/documentation/faq.html#custom-pid-in-url 1275 for (var j = 0; j < items.length; j++) { 1276 if (items[j].pid == index) { 1277 options.index = j; 1278 break; 1279 } 1280 } 1281 } else { 1282 // in URL indexes start from 1 1283 options.index = parseInt(index, 10) - 1; 1284 } 1285 } else { 1286 options.index = parseInt(index, 10); 1287 } 1288 1289 // exit if index not found 1290 if (isNaN(options.index)) { 1291 return; 1292 } 1293 1294 if (disableAnimation) { 1295 options.showAnimationDuration = 0; 1296 } 1297 1298 // Pass data to PhotoSwipe and initialize it 1299 gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); 1300 gallery.init(); 1301 1302 gallery.listen('close', function () { 1303 $('body').removeClass('photoSwipeOpen'); 1304 }); 1305 1306 gallery.listen('afterChange', function () { 1307 1308 var curr = gallery.currItem; 1309 var index2 = curr.el.dataset.slickIndex; 1310 console.log(index2); 1311 // $('.slick-photoswipe-slider').slick('slickGoTo', index); 1312 1313 // $('.slick-photoswipe-slider').slick("slickSetOption", 'speed', 1, true); 1314 // $('.slick-photoswipe-slider').slick("slickSetOption", 'waitForAnimate', false, false); 1315 $(gallerySelector).slick('slickGoTo', index2); 1316 // $('.slick-photoswipe-slider').slick("slickSetOption", 'speed', 300, true); 1317 // $('.slick-photoswipe-slider').slick("slickSetOption", 'waitForAnimate', true, false); 1318 1319 }); 1320 1321 }; 1322 1323 // loop through all gallery elements and bind events 1324 var galleryElements = document.querySelectorAll(gallerySelector); 1325 1326 for (var i = 0, l = galleryElements.length; i < l; i++) { 1327 galleryElements[i].setAttribute('data-pswp-uid', i + 1); 1328 galleryElements[i].onclick = onThumbnailsClick; 1329 } 1330 1331 // Parse URL and open gallery if it contains #&pid=3&gid=1 1332 var hashData = photoswipeParseHash(); 1333 if (hashData.pid && hashData.gid) { 1334 openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true); 1335 } 1336 }; 1337 1338 var initSlickPhotoSwipeSlider = function () { 1339 if ($('.slick-photoswipe-block').length) { 1340 initPhotoSwipeFromDOM('.slick-photoswipe-slider'); 1341 $('.slick-photoswipe-slider').slick({ 1342 adaptiveHeight: true, 1343 slidesToShow: 1, 1344 slidesToScroll: 1, 1345 swipe: true, 1346 infinite: true, 1347 swipeToSlide: true, 1348 dots: false, 1349 arrows: true, 1350 responsive: [ 1351 { 1352 breakpoint: 1024, 1353 settings: { 1354 slidesToShow: 1, 1355 slidesToScroll: 1,
1356 arrows: false, 1357 dots: true, 1358 } 1359 } 1360 ] 1361 }); 1362 $('.slick-photoswipe-slider').on('beforeChange', function (event, slick, currentSlide, nextSlide) { 1363 var mySlideNumber = nextSlide; 1364 $('.slider-nav .slick-slide').removeClass('slick-active'); 1365 $('.slider-nav .slick-slide').eq(mySlideNumber).addClass('slick-active'); 1366 }); 1367 } 1368 }; 1369 1370 var initAccordion = function () { 1371 if ($('.accordion').length) { 1372 $(document).on('click', '.accordion', function () { 1373 $this = $(this); 1374 $target = $this.next(); 1375 1376 if (!$target.hasClass('active')) { 1377 $this.addClass('active'); 1378 $target.addClass('active').slideDown('slow'); 1379 } else { 1380 $target.removeClass('active').stop(true, true).slideUp('slow'); 1381 $this.removeClass('active'); 1382 } 1383 }); 1384 } 1385 if ($('.floorplan-accordion').length) { 1386 $(document).on('click', '.floorplan-accordion', function () { 1387 $this = $(this); 1388 $target = $this.next(); 1389 1390 if (!$target.hasClass('active')) { 1391 $this.addClass('active'); 1392 $target.addClass('active').slideDown('slow'); 1393 } else { 1394 $target.removeClass('active').stop(true, true).slideUp('slow'); 1395 $this.removeClass('active'); 1396 } 1397 }); 1398 } 1399 }; 1400 1401 //Range Slider 1402 var rangeSlider = function (range, rangesValues, rangeType, step) { 1403 var $range = $(range); 1404 var $from = $range.parent().find('.slider-from'); 1405 var $to = $range.parent().find('.slider-to'); 1406 var $rangeValues = $range.parents('.filter-option-range').find('.range-values'); 1407 if (typeof $.fn.slider !== 'function') { 1408 return; 1409 } 1410 if ($range.length) { 1411 // var rangeType = rangeType == 'price' ? ['$', 'K'] : ['', rangeType]; 1412 var rangeType = $range.data('range-types'), 1413 rangesValues = $range.data('ranges'); 1414 $range.slider({ 1415 range: true, 1416 min: rangesValues[0], 1417 max: rangesValues[1], 1418 step: $range.data('step') ? $range.data('step') : step, 1419 values: rangesValues, 1420 change: function (event, ui) { 1421 $from.html(rangeType[0] + ui.values[0] + rangeType[1]); 1422 $to.html(rangeType[0] + ui.values[1] + rangeType[1]); 1423 $rangeValues.val(rangeType[0] + ui.values[0] + rangeType[1] + " - " + rangeType[0] + ui.values[1] + rangeType[1]); 1424 } 1425 }); 1426 $from.html(rangeType[0] + rangesValues[0] + rangeType[1]); 1427 $to.html(rangeType[0] + rangesValues[1] + rangeType[1]); 1428 $rangeValues.val(rangeType[0] + $range.slider("values", 0) + rangeType[1] + " - " + rangeType[0] + $range.slider("values", 1) + rangeType[1]); 1429 1430 } 1431 }; 1432 1433 //Toggle Siblings on Click 1434 var toggleOnClick = function (btn, toggleElem) { 1435 $(btn).on('click', function () { 1436 $(this).toggleClass('active') 1437 $(this).next(toggleElem).slideToggle(); 1438 }) 1439 } 1440 1441 //Unite 1442 var uniteGallery = function (id) { 1443 if ($(id).length) { 1444 var galleryOptions = { 1445 slider_enable_zoom_panel: false, 1446 theme_enable_text_panel: false, 1447 slider_control_zoom: false, 1448 strippanel_enable_handle: false,
1449 strippanel_enable_buttons: false, 1450 theme_enable_hidepanel_button: false, 1451 theme_enable_play_button: false, 1452 thumb_height: 0, 1453 thumb_width: 0, 1454 slider_enable_bullets: false, 1455 slider_bullets_offset_vert: 100, 1456 slider_scale_mode: "down", 1457 } 1458 var galleryFacade = $(id).unitegallery(galleryOptions); 1459 var galleryFacadeCaption = $(id).next('.gallery-details').find('.caption'); 1460 var galleryFacadeTotal = $(id).next('.gallery-details').find('.counter .total'); 1461 var galleryFacadeCurrent = $(id).next('.gallery-details').find('.counter .current-num'); 1462 1463 1464 galleryFacadeTotal.html(galleryFacade.getNumItems()); 1465 galleryFacade.on("item_change", function (num, data) { 1466 galleryFacadeCaption.removeAttr('style'); 1467 if ($.trim(data.description) != '') { 1468 galleryFacadeCaption.html(data.description); 1469 } else { 1470 galleryFacadeCaption.css('visibility', 'hidden'); 1471 } 1472 galleryFacadeCurrent.html(num + 1); 1473 }); 1474 1475 var firstSlide = galleryFacade.getItem(0); 1476 galleryFacadeCaption.html(firstSlide.description); 1477 galleryFacadeCurrent.html(firstSlide.index + 1); 1478 1479 // change if other gallery added 1480 document.querySelector(id).onfullscreenchange = function () { 1481 $(id).toggleClass('fullscreencast'); 1482 if (!$(id).children('.gallery-details').length) { 1483 var countDrac = $(id).parents('.gallery-holder').children('.gallery-details').clone(); 1484 $(id).append(countDrac); 1485 1486 1487 // for fullscreen view 1488 var fullCaption = countDrac.find('.caption'); 1489 var fullTotal = countDrac.find('.counter .total'); 1490 var fullCurrent = countDrac.find('.counter .current-num'); 1491 fullTotal.html(galleryFacade.getNumItems()); 1492 galleryFacade.on("item_change", function (num, data) { 1493 fullCaption.html(data.description); 1494 fullCurrent.html(num + 1); 1495 }); 1496 } 1497 } 1498 1499 document.addEventListener('webkitfullscreenchange', fullScreenCast(id)); 1500 document.addEventListener('mozfullscreenchange', fullScreenCast(id)); 1501 document.addEventListener('msfullscreenchange', fullScreenCast(id)); 1502 document.addEventListener('fullscreenchange', fullScreenCast(id)); 1503 1504 function fullScreenCast(id) { 1505 $(id).toggleClass('fullscreencast'); 1506 if (!$(id).children('.gallery-details').length) { 1507 var countDrac = $(id).parents('.gallery-holder').children('.gallery-details').clone(); 1508 $(id).append(countDrac); 1509 1510 1511 // for fullscreen view 1512 var fullCaption = countDrac.find('.caption'); 1513 var fullTotal = countDrac.find('.counter .total'); 1514 var fullCurrent = countDrac.find('.counter .current-num'); 1515 fullTotal.html(galleryFacade.getNumItems()); 1516 galleryFacade.on("item_change", function (num, data) { 1517 fullCaption.html(data.description); 1518 fullCurrent.html(num + 1); 1519 }); 1520 } 1521 } 1522 } 1523 } 1524 1525 var initArticleSlider = function () { 1526 const $articleSlider = $('.article-slider'); 1527 if (!$articleSlider.length) { 1528 return; 1529 } 1530 1531 $articleSlider.slick({ 1532 slidesToShow: 1, 1533 slidesToScroll: 1, 1534 swipe: true, 1535 infinite: true, 1536 swipeToSlide: true, 1537 dots: true, 1538 arrows: true, 1539 autoplay: true, 1540 autoplaySpeed: 4000, 1541 }); 1542 } 1543 1544 var initBannerSlider = function () { 1545 const $bannerSlider = $('.banner-slider'); 1546 if (!$bannerSlider.length) { 1547 return; 1548 } 1549 1550 $bannerSlider.slick({ 1551 slidesToShow: 1, 1552 slidesToScroll: 1, 1553 swipe: false, 1554 infinite: true, 1555 swipeToSlide: false, 1556 dots: true,
1557 arrows: false, 1558 autoplay: true, 1559 autoplaySpeed: 4000, 1560 fade: true, 1561 cssEase: 'linear' 1562 }); 1563 } 1564 1565 var initTestimonialSlider = function () { 1566 const $testimonialSlider = $('.testimonial-slider'); 1567 if (!$testimonialSlider.length) { 1568 return; 1569 } 1570 1571 $testimonialSlider.slick({ 1572 slidesToShow: 1, 1573 slidesToScroll: 1, 1574 swipe: true, 1575 infinite: true, 1576 swipeToSlide: true, 1577 dots: true, 1578 arrows: true 1579 }); 1580 } 1581 1582 var initTwoColSlider = function () { 1583 if ($('.two-col-slider').length) { 1584 var $swiperSelector = $('.two-col-slider .swiper-container'); 1585 1586 $swiperSelector.each(function (index) { 1587 var $this = $(this); 1588 $this.addClass('swiper-slider-' + index); 1589 1590 var dragSize = $this.data('drag-size') ? $this.data('drag-size') : 50; 1591 var freeMode = $this.data('free-mode') ? $this.data('free-mode') : false; 1592 var loop = $this.data('loop') ? $this.data('loop') : false; 1593 var slidesDesktop = $this.data('slides-desktop') ? $this.data('slides-desktop') : 2.1; 1594 var slidesTablet = $this.data('slides-tablet') ? $this.data('slides-tablet') : 2.1; 1595 var slidesMobile = $this.data('slides-mobile') ? $this.data('slides-mobile') : 1.1; 1596 var spaceBetween = $this.data('space-between') ? $this.data('space-between') : 32; 1597 1598 if (window.innerWidth < 1200) { 1599 spaceBetween = 24; 1600 } 1601 if (window.innerWidth < 1024) { 1602 spaceBetween = 16; 1603 } 1604 1605 var swiper = new Swiper('.swiper-slider-' + index, { 1606 direction: 'horizontal', 1607 loop: loop, 1608 freeMode: freeMode, 1609 spaceBetween: spaceBetween, 1610 breakpoints: { 1611 1920: { 1612 slidesPerView: slidesDesktop 1613 }, 1614 768: { 1615 slidesPerView: slidesTablet 1616 }, 1617 320: { 1618 slidesPerView: slidesMobile 1619 } 1620 }, 1621 navigation: { 1622 nextEl: '.swiper-button-next', 1623 prevEl: '.swiper-button-prev' 1624 }, 1625 scrollbar: { 1626 el: '.swiper-scrollbar', 1627 draggable: true, 1628 // dragSize: dragSize 1629 } 1630 }); 1631 }); 1632 } 1633 } 1634 1635 var initNewsSlider = function () { 1636 if ($('.news-slider').length) { 1637 var $swiperSelector = $('.news-slider .swiper-container'); 1638 1639 $swiperSelector.each(function (index) { 1640 var $this = $(this); 1641 $this.addClass('news-swiper-slider-' + index); 1642 1643 var dragSize = $this.data('drag-size') ? $this.data('drag-size') : 50; 1644 var freeMode = $this.data('free-mode') ? $this.data('free-mode') : false; 1645 var loop = $this.data('loop') ? $this.data('loop') : false; 1646 var slidesDesktop = $this.data('slides-desktop') ? $this.data('slides-desktop') : 2.5; 1647 var slidesTablet = $this.data('slides-tablet') ? $this.data('slides-tablet') : 1.8; 1648 var slidesMobile = $this.data('slides-mobile') ? $this.data('slides-mobile') : 1.1; 1649 var spaceBetween = $this.data('space-between') ? $this.data('space-between') : 40; 1650 1651 if (window.innerWidth < 1200) { 1652 spaceBetween = 24; 1653 } 1654 if (window.innerWidth < 1024) { 1655 spaceBetween = 16; 1656 } 1657 1658 var swiper = new Swiper('.news-swiper-slider-' + index, { 1659 direction: 'horizontal', 1660 loop: loop, 1661 freeMode: freeMode, 1662 spaceBetween: spaceBetween, 1663 breakpoints: { 1664 1024: { 1665 slidesPerView: slidesDesktop 1666 }, 1667 768: { 1668 slidesPerView: slidesTablet 1669 }, 1670 320: { 1671 slidesPerView: slidesMobile 1672 } 1673 }, 1674 navigation: { 1675 nextEl: '.swiper-button-next', 1676 prevEl: '.swiper-button-prev' 1677 }, 1678 scrollbar: { 1679 el: '.swiper-scrollbar', 1680 draggable: true, 1681 // dragSize: dragSize 1682 } 1683 }); 1684 }); 1685 } 1686 } 1687 1688 var initOtherHomesSlider = function () { 1689 if ($('.other-homes-slider').length) { 1690 var $swiperSelector = $('.other-homes-slider .swiper-container'); 1691 1692 $swiperSelector.each(function (index) { 1693 var $this = $(this); 1694 $this.addClass('other-homes-swiper-slider-' + index); 1695 1696 var dragSize = $this.data('drag-size') ? $this.data('drag-size') : 50; 1697 var freeMode = $this.data('free-mode') ? $this.data('free-mode') : false;
1698 var loop = $this.data('loop') ? $this.data('loop') : false; 1699 var slidesDesktop = $this.data('slides-desktop') ? $this.data('slides-desktop') : 3.05; 1700 var slidesTablet = $this.data('slides-tablet') ? $this.data('slides-tablet') : 2.5; 1701 var slidesMobile = $this.data('slides-mobile') ? $this.data('slides-mobile') : 1; 1702 var spaceBetween = $this.data('space-between') ? $this.data('space-between') : 30; 1703 1704 if (window.innerWidth < 1200) { 1705 spaceBetween = 24; 1706 } 1707 if (window.innerWidth < 1024) { 1708 spaceBetween = 16; 1709 } 1710 1711 var swiper = new Swiper('.other-homes-swiper-slider-' + index, { 1712 direction: 'horizontal', 1713 loop: loop, 1714 freeMode: freeMode, 1715 spaceBetween: spaceBetween, 1716 breakpoints: { 1717 1024: { 1718 slidesPerView: slidesDesktop 1719 }, 1720 768: { 1721 slidesPerView: slidesTablet 1722 }, 1723 320: { 1724 slidesPerView: slidesMobile 1725 } 1726 }, 1727 navigation: { 1728 nextEl: '.swiper-button-next', 1729 prevEl: '.swiper-button-prev' 1730 }, 1731 scrollbar: { 1732 el: '.swiper-scrollbar', 1733 draggable: true, 1734 // dragSize: dragSize 1735 } 1736 }); 1737 $('.home-designs-list__tabs .floorplan-tab-content .tab-content').matchHeight({ 1738 byRow: false, 1739 property: 'height', 1740 target: null, 1741 remove: false 1742 }); 1743 $('.home-designs-list__tabs').matchHeight({ 1744 byRow: false, 1745 property: 'height', 1746 target: null, 1747 remove: false 1748 }); 1749 // initFacadeSlider(); 1750 }); 1751 } 1752 } 1753 var initHalSlider = function () { 1754 if ($('.hal-slider').length) { 1755 var $swiperSelector = $('.hal-slider .swiper-container'); 1756 1757 $swiperSelector.each(function (index) { 1758 var $this = $(this); 1759 $this.addClass('hal-swiper-slider-' + index); 1760 1761 var dragSize = $this.data('drag-size') ? $this.data('drag-size') : 50; 1762 var freeMode = $this.data('free-mode') ? $this.data('free-mode') : false; 1763 var loop = $this.data('loop') ? $this.data('loop') : false; 1764 var slidesXL = $this.data('slides-xl') ? $this.data('slides-xl') : 3; 1765 var slidesDesktop = $this.data('slides-desktop') ? $this.data('slides-desktop') : 2.3; 1766 var slidesTablet = $this.data('slides-tablet') ? $this.data('slides-tablet') : 2.1; 1767 var slidesMobile = $this.data('slides-mobile') ? $this.data('slides-mobile') : 1; 1768 var spaceBetween = $this.data('space-between') ? $this.data('space-between') : 30; 1769 1770 if (window.innerWidth < 1200) { 1771 spaceBetween = 24; 1772 } 1773 if (window.innerWidth < 1024) { 1774 spaceBetween = 16; 1775 } 1776 1777 var swiper = new Swiper('.hal-swiper-slider-' + index, { 1778 direction: 'horizontal', 1779 loop: loop, 1780 freeMode: freeMode, 1781 spaceBetween: spaceBetween, 1782 breakpoints: { 1783 1200: { 1784 slidesPerView: slidesXL 1785 }, 1786 1024: { 1787 slidesPerView: slidesDesktop 1788 }, 1789 768: { 1790 slidesPerView: slidesTablet 1791 }, 1792 320: { 1793 slidesPerView: slidesMobile 1794 } 1795 }, 1796 navigation: { 1797 nextEl: '.swiper-button-next', 1798 prevEl: '.swiper-button-prev' 1799 }, 1800 scrollbar: { 1801 el: '.swiper-scrollbar', 1802 draggable: true, 1803 // dragSize: dragSize 1804 } 1805 }); 1806 }); 1807 } 1808 } 1809 1810 var initFESlider = function () { 1811 if ($('.featured-estates-slider').length) { 1812 var $swiperSelector = $('.featured-estates-slider .swiper-container'); 1813 1814 $swiperSelector.each(function (index) { 1815 var $this = $(this); 1816 $this.addClass('featured-estates-swiper-slider-' + index); 1817 1818 var dragSize = $this.data('drag-size') ? $this.data('drag-size') : 50; 1819 var freeMode = $this.data('free-mode') ? $this.data('free-mode') : false;
1820 var loop = $this.data('loop') ? $this.data('loop') : false; 1821 var slidesXL = $this.data('slides-xl') ? $this.data('slides-xl') : 2; 1822 var slidesDesktop = $this.data('slides-desktop') ? $this.data('slides-desktop') : 2; 1823 var slidesTablet = $this.data('slides-tablet') ? $this.data('slides-tablet') : 2; 1824 var slidesMobile = $this.data('slides-mobile') ? $this.data('slides-mobile') : 1; 1825 var spaceBetween = $this.data('space-between') ? $this.data('space-between') : 40; 1826 1827 if (window.innerWidth < 1200) { 1828 spaceBetween = 40; 1829 } 1830 if (window.innerWidth < 1024) { 1831 spaceBetween = 16; 1832 } 1833 1834 var swiper = new Swiper('.featured-estates-swiper-slider-' + index, { 1835 direction: 'horizontal', 1836 loop: loop, 1837 freeMode: freeMode, 1838 spaceBetween: spaceBetween, 1839 breakpoints: { 1840 1200: { 1841 slidesPerView: slidesXL 1842 }, 1843 1024: { 1844 slidesPerView: slidesDesktop 1845 }, 1846 768: { 1847 slidesPerView: slidesTablet 1848 }, 1849 320: { 1850 slidesPerView: slidesMobile 1851 } 1852 }, 1853 navigation: { 1854 nextEl: '.swiper-button-next', 1855 prevEl: '.swiper-button-prev' 1856 }, 1857 scrollbar: { 1858 el: '.swiper-scrollbar', 1859 draggable: true, 1860 // dragSize: dragSize 1861 } 1862 }); 1863 }); 1864 } 1865 } 1866 var initSCSlider = function () { 1867 var $status = $('.slide-count-wrap'); 1868 var $slickElement = $('.sales-centre-slider'); 1869 if (!$slickElement.length) { 1870 return; 1871 } 1872 1873 $slickElement.on('init reInit afterChange', function (event, slick, currentSlide) { 1874 var i = (currentSlide ? currentSlide : 0) + 1; 1875 $status.find('.current').text(i); 1876 $status.find('.total').text(slick.slideCount); 1877 }); 1878 1879 $slickElement.not('.slick-initialized').slick({ 1880 adaptiveHeight: true, 1881 slidesToShow: 1, 1882 slidesToScroll: 1, 1883 swipe: true, 1884 infinite: true, 1885 swipeToSlide: true, 1886 dots: false, 1887 arrows: true, 1888 }); 1889 1890 $slickElement.slick('setPosition'); 1891 }; 1892 1893 var initFavouritesSlider = function () { 1894 const favouritesSlider = $('.favourites-slider'); 1895 if (favouritesSlider.length) { 1896 var $swiperSelector = favouritesSlider.find('.swiper-container'); 1897 $swiperSelector.each(function (index) { 1898 var $this = $(this); 1899 $this.addClass('favourites-swiper-slider-' + index); 1900 const noFavouritesSlide = $this.find('.no-favourites-slide'); 1901 noFavouritesSlide.detach(); 1902 1903 var dragSize = $this.data('drag-size') ? $this.data('drag-size') : 50; 1904 var freeMode = $this.data('free-mode') ? $this.data('free-mode') : false; 1905 var loop = $this.data('loop') ? $this.data('loop') : false; 1906 var slidesXL = $this.data('slides-xl') ? $this.data('slides-xl') : 3; 1907 var slidesDesktop = $this.data('slides-desktop') ? $this.data('slides-desktop') : 2.3; 1908 var slidesTablet = $this.data('slides-tablet') ? $this.data('slides-tablet') : 2.1; 1909 var slidesMobile = $this.data('slides-mobile') ? $this.data('slides-mobile') : 1; 1910 var spaceBetween = $this.data('space-between') ? $this.data('space-between') : 30; 1911 1912 if (window.innerWidth < 1200) { 1913 spaceBetween = 24; 1914 } 1915 if (window.innerWidth < 1024) { 1916 spaceBetween = 16; 1917 } 1918 if (window.innerWidth < 768) { 1919 spaceBetween = 8; 1920 } 1921 1922 var swiper = new Swiper('.favourites-swiper-slider-' + index, { 1923 direction: 'horizontal', 1924 loop: loop, 1925 freeMode: freeMode, 1926 spaceBetween: spaceBetween, 1927 breakpoints: { 1928 1200: { 1929 slidesPerView: slidesXL 1930 }, 1931 1024: { 1932 slidesPerView: slidesDesktop 1933 }, 1934 768: { 1935 slidesPerView: slidesTablet 1936 }, 1937 320: { 1938 slidesPerView: slidesMobile 1939 } 1940 }, 1941 navigation: { 1942 nextEl: '.swiper-button-next', 1943 prevEl: '.swiper-button-prev' 1944 }, 1945 scrollbar: { 1946 el: '.swiper-scrollbar', 1947 draggable: true, 1948 // dragSize: dragSize 1949 } 1950 }); 1951 1952 const checkSlider = () => { 1953 if (swiper.slides.length === 0) { 1954 swiper.appendSlide(noFavouritesSlide.get(0)); 1955 } 1956 }; 1957
1958 swiper.slides.forEach(element => { 1959 const $element = $(element); 1960 const id = String($element.data('id')); 1961 $element.find('.favourites-remove-button').click(() => { 1962 swiper.removeSlide(swiper.slides.indexOf(element)) 1963 favouriteHomesApp ? favouriteHomesApp.delete(id) : null; 1964 checkSlider(); 1965 }); 1966 }); 1967 1968 checkSlider(); 1969 1970 $this.data('swiper', swiper); 1971 }); 1972 } 1973 } 1974 //Virtual to show embedded iframe 1975 var virtualEmbedShow = function () { 1976 $('.button-virtual').on('click', function () { 1977 var imgObj = $(this).next('.image-holder'); 1978 var iframeSrc = imgObj.next('.iframe-holder').find('iframe').data('defer-src'); 1979 $(this).hide().parent().addClass('active'); 1980 imgObj.hide(); 1981 imgObj.next('.iframe-holder').removeClass('hide'); 1982 imgObj.next('.iframe-holder').find('iframe').attr('src', iframeSrc) 1983 }) 1984 } 1985 1986 var readMoreContent = function () { 1987 var calcContentHeight = $('.readmore-html').find('.column').css('height'); 1988 $('.readmore-html').find('.column').css({ 1989 height: '300px' 1990 }) 1991 $('.readmore-html .button-more').on('click', function () { 1992 var parent = $(this).closest('.readmore-html'); 1993 parent.toggleClass('opened'); 1994 parent.find('.column').stop().animate({ 1995 height: parent.hasClass('opened') ? calcContentHeight : '300px' 1996 }, 700) 1997 1998 }) 1999 } 2000 2001 var initRecentlyViewedSlider = function () { 2002 const $recentlyViewedList = $('.recently-viewed-list'); 2003 if ($recentlyViewedList.length && window.innerWidth < 1024) { 2004 $recentlyViewedList.slick({ 2005 adaptiveHeight: true, 2006 variableWidth: true, 2007 slidesToShow: 2, 2008 slidesToScroll: 1, 2009 swipe: true, 2010 infinite: false, 2011 swipeToSlide: true, 2012 dots: false, 2013 arrows: false 2014 }); 2015 } 2016 } 2017 2018 var initTabcontrolSlider = function () { 2019 if (window.innerWidth < 1024) { 2020 const $tabControls = $('.tabset .tab-controls'); 2021 if ($tabControls.length) { 2022 $tabControls.slick({ 2023 adaptiveHeight: true, 2024 variableWidth: true, 2025 slidesToScroll: 1, 2026 swipe: true, 2027 infinite: false, 2028 swipeToSlide: true, 2029 dots: false, 2030 arrows: false 2031 }); 2032 } 2033 2034 const $dhTabControls = $('.dh-tabset .dh-tab-controls'); 2035 if ($dhTabControls.length) { 2036 $dhTabControls.slick({ 2037 adaptiveHeight: true, 2038 variableWidth: true, 2039 slidesToScroll: 1, 2040 swipe: true, 2041 infinite: false, 2042 swipeToSlide: true, 2043 dots: false, 2044 arrows: false 2045 }); 2046 } 2047 } 2048 } 2049 2050 var initFacadeSlider = function () { 2051 $('.facade-slider').each(function () { 2052 var sliderId = $(this).attr('id'); 2053 $('#' + sliderId).on('load', function () { 2054 $('#' + sliderId).not('.slick-initialized').slick({ 2055 adaptiveHeight: true, 2056 slidesToShow: 1, 2057 slidesToScroll: 1, 2058 swipe: true, 2059 infinite: true, 2060 swipeToSlide: true, 2061 dots: false, 2062 arrows: true, 2063 }); 2064 $('#' + sliderId).slick('setPosition'); 2065 }()); 2066 }); 2067 } 2068 2069 var initHomeDesignsFacadeSlider = function () { 2070 $('.home-design-facade-slider:not(.home-designs-app-slider)').each(function () { 2071 var sliderId = $(this).attr('id'); 2072 $('#' + sliderId).on('load', function () { 2073 $('#' + sliderId).not('.slick-initialized').slick({ 2074 adaptiveHeight: true, 2075 slidesToShow: 1, 2076 slidesToScroll: 1, 2077 swipe: true, 2078 infinite: true, 2079 swipeToSlide: true, 2080 dots: true, 2081 arrows: true, 2082 }); 2083 $('#' + sliderId).slick('setPosition'); 2084 }()); 2085 }); 2086 2087 $('.favourites__tabs .floorplan-tab-content .tab-content .facade-image').matchHeight({ 2088 byRow: false, 2089 property: 'height', 2090 target: null, 2091 remove: false 2092 }); 2093 } 2094 2095 var initSalesCentreFacadeSlider = function () { 2096 $('.sales-centre-slider.home-design-facade-slider.home-designs-app-slider').each(function () { 2097 var sliderId = $(this).attr('id'); 2098 $('#' + sliderId).on('load', function () { 2099 $('#' + sliderId).not('.slick-initialized').slick({ 2100 adaptiveHeight: true, 2101 slidesToShow: 1, 2102 slidesToScroll: 1, 2103 swipe: true, 2104 infinite: true, 2105 swipeToSlide: true, 2106 dots: true, 2107 arrows: true, 2108 }); 2109 $('#' + sliderId).slick('setPosition'); 2110 }()); 2111 }); 2112 } 2113 2114 var initFeaturedEstatesSlider = function () { 2115 $('.featured-estates-slider').on('load', function () { 2116 $('.featured-estates-slider').not('.slick-initialized').slick({ 2117 adaptiveHeight: true, 2118 slidesToShow: 1, 2119 slidesToScroll: 1, 2120 swipe: true, 2121 infinite: true, 2122 swipeToSlide: true, 2123 dots: true, 2124 arrows: true, 2125 }); 2126 $('.featured-estates-slider').slick('setPosition'); 2127 }()); 2128 } 2129 2130 //Range Slider 2131 var rangeSlider = function (range, rangesValues, rangeType, step) { 2132 var $range = $(range); 2133 var $from = $range.parent().find('.slider-from'); 2134 var $to = $range.parent().find('.slider-to'); 2135 var $rangeValues = $range.parents('.filter-option-range').find('.range-values'); 2136 if (typeof $.fn.slider !== 'function') { 2137 return; 2138 } 2139 if ($range.length) { 2140 // var rangeType = rangeType == 'price' ? ['$', 'K'] : ['', rangeType]; 2141 var rangeType = $range.data('range-types'), rangesValues = $range.data('ranges'); 2142 $range.slider({ 2143 range: true, 2144 min: rangesValues[0], 2145 max: rangesValues[1], 2146 step: $range.data('step') ? $range.data('step') : step, 2147 values: rangesValues, 2148 slide: function (event, ui) { 2149 2150 var temp_from_val = ui.values[0]; 2151 var temp_from_val_type = rangeType[1]; 2152 var temp_to_val = ui.values[1]; 2153 var temp_to_val_type = rangeType[1]; 2154 2155 if (temp_from_val >= 1000) { 2156 temp_from_val = temp_from_val / 1000; 2157 temp_from_val_type = 'M'; 2158 } 2159 2160 if (temp_to_val >= 1000) { 2161 temp_to_val = temp_to_val / 1000; 2162 temp_to_val_type = 'M'; 2163 } 2164 2165 $from.html(rangeType[0] + ui.values[0] + rangeType[1]); 2166 $to.html(rangeType[0] + ui.values[1] + rangeType[1]); 2167 $rangeValues.val(rangeType[0] + temp_from_val + temp_from_val_type + " - " + rangeType[0] + temp_to_val + temp_to_val_type); 2168 }, 2169 change: function (event, ui) { 2170 var temp_from_val = ui.values[0]; 2171 var temp_from_val_type = rangeType[1]; 2172 var temp_to_val = ui.values[1]; 2173 var temp_to_val_type = rangeType[1]; 2174 2175 if (temp_from_val >= 1000) { 2176 temp_from_val = temp_from_val / 1000; 2177 temp_from_val_type = 'M'; 2178 } 2179 2180 if (temp_to_val >= 1000) { 2181 temp_to_val = temp_to_val / 1000; 2182 temp_to_val_type = 'M'; 2183 } 2184 2185 $from.html(rangeType[0] + ui.values[0] + rangeType[1]); 2186 $to.html(rangeType[0] + ui.values[1] + rangeType[1]); 2187 $rangeValues.val(rangeType[0] + temp_from_val + temp_from_val_type + " - " + rangeType[0] + temp_to_val + temp_to_val_type); 2188 } 2189 }); 2190 $from.html(rangeType[0] + rangesValues[0] + rangeType[1]); 2191 $to.html(rangeType[0] + rangesValues[1] + rangeType[1]); 2192 $rangeValues.val(rangeType[0] + $range.slider("values", 0) + rangeType[1] + " - " + rangeType[0] + $range.slider("values", 1) + rangeType[1]); 2193 2194 } 2195 }; 2196 2197 var initStickyFilter = function () { 2198 var filter = document.getElementById("sticky-filter"); 2199 if (filter) { 2200 var sticky = filter.offsetTop; 2201 2202 if (window.pageYOffset > sticky) { 2203 filter.classList.add("sticky"); 2204 } else { 2205 filter.classList.remove("sticky"); 2206 } 2207 } 2208 } 2209 2210 var initStickyHeader = function () { 2211 if ($('header .header-bottom').length) { 2212 var stickyHeader = document.getElementById("stickyHeader"); 2213 var sticky = stickyHeader.offsetTop; 2214 2215 if ($(window).scrollTop() > sticky) { 2216 stickyHeader.classList.add("sticky-header"); 2217 } else { 2218 stickyHeader.classList.remove("sticky-header"); 2219 } 2220 } 2221 } 2222 2223 2224 var initInclusionsSlider = function () { 2225 const $sliderTheme = $('.slider-theme'); 2226 if ($sliderTheme.length) { 2227 $sliderTheme.slick({ 2228 slidesToShow: 1, 2229 slidesToScroll: 1,
2230 arrows: false, 2231 fade: false, 2232 dots: false, 2233 // asNavFor: '.slider-theme-nav', 2234 adaptiveHeight: true, 2235 infinite: true, 2236 swipeToSlide: false, 2237 swipe: false, 2238 responsive: [{ 2239 breakpoint: 767, 2240 settings: { 2241 dots: false, 2242 arrows: false, 2243 swipe: false, 2244 // infinite: false 2245 } 2246 }] 2247 }); 2248 $('.slider-theme-nav').slick({ 2249 slidesToShow: 4, 2250 slidesToScroll: 1, 2251 asNavFor: '.slider-theme', 2252 dots: false, 2253 centerMode: false, 2254 focusOnSelect: true, 2255 arrows: false, 2256 infinite: true, 2257 swipeToSlide: true, 2258 responsive: [{ 2259 breakpoint: 1023, 2260 settings: { 2261 slidesToShow: 4, 2262 slidesToScroll: 1 2263 } 2264 }, 2265 { 2266 breakpoint: 768, 2267 settings: { 2268 slidesToScroll: 1, 2269 slidesToShow: 1, 2270 infinite: false, 2271 dots: true, 2272 arrows: true, 2273 appendDots: $('.box-theme .expand-content'), 2274 customPaging: function (slider, i) { 2275 var title = $(slider.$slides[i]).find('.text').text(); 2276 return '<span>' + title + '</span>'; 2277 } 2278 } 2279 } 2280 ] 2281 2282 }); 2283 } 2284 //Tooltip - Interior Theme 2285 $('.tip').on('click', function () { 2286 var targetid = $(this).attr('target'); 2287 2288 $('.tip').not($(this)).removeClass('active'); 2289 //$('.tip').not('[target = '+targetid+']').removeClass('active'); 2290 $('.tip').not('[target = ' + targetid + ']').parent('.tooltip-content').removeClass('active'); 2291 $('.tip').not('[target = ' + targetid + ']').parent('.nav-dots').removeClass('active'); 2292 $('[target = ' + targetid + ']').toggleClass('active'); 2293 2294 $(this).parent('.tooltip-content').toggleClass('active'); 2295 $(this).parent('.nav-dot').toggleClass('active'); 2296 2297 if ($(this).hasClass('active')) { 2298 if ($(this).parents('.slider-item').find('.tooltip-content-area').css('display') == 'none') { 2299 $(this).parents('.slider-item').find('.tooltip-content-area').fadeIn(); 2300 } 2301 } 2302 if ($(this).parent('.tooltip-content').hasClass('top')) { 2303 var contentHeight = $(this).parent('.tooltip-content').find('.content').outerHeight(); 2304 var gap = 36; 2305 var marginTop = contentHeight + gap; 2306 $(this).parent('.tooltip-content').find('.content').css('margin-top', '-' + marginTop + 'px'); 2307 } 2308 }) 2309 $('.button-expand').each(function () { 2310 $(this).click(function () { 2311 $(this).toggleClass('active'); 2312 $(this).next('.expand-content').slideToggle(); 2313 }) 2314 }) 2315 $('.expand-content').find('.slick-dots li').click(function () { 2316 var textCurrent = $(this).find('span').text(); 2317 $(this).parents('.expand-content').css('display', 'none'); 2318 $(this).parents('.expand-holder').find('.button-expand').removeClass('active'); 2319 $(this).parents('.expand-holder').find('.button-expand').text(textCurrent); 2320 }); 2321 //Toggle tooltip content 2322 const $mapInfo = $('.map-info'); 2323 $('.slider-theme .slider-item').each(function () { 2324 $(this).find('.toggle-tooltip').click(function () { 2325 $(this).parents('.slider-item').find('.target-content').removeClass('active').hide(); 2326 $(this).parents('.slider-item').find('.toggle-tooltip').removeClass('active-button'); 2327 $(this).addClass('active-button'); 2328 $('#' + $(this).attr('target')).addClass('active').fadeIn(100).show().trigger('click'); 2329 }); 2330 2331 if ($mapInfo.length) { 2332 $(this).find('.map-info').mouseover(function () { 2333 $('.toggle-tooltip').removeClass('active active-button'); 2334 $('.tooltip-content').removeClass('active'); 2335 $(this).children('.toggle-tooltip').addClass('active active-button'); 2336 $(this).addClass('active'); 2337 $(this).children('.content').mouseleave(function () { 2338 $('.toggle-tooltip').removeClass('active active-button'); 2339 $('.tooltip-content').removeClass('active'); 2340 }); 2341 $(this).mouseleave(function () { 2342 $('.toggle-tooltip').removeClass('active active-button'); 2343 $('.tooltip-content').removeClass('active'); 2344 }); 2345 }); 2346 2347 $(this).find('.map-info .toggle-tooltip').mouseenter(function () { 2348 $('.toggle-tooltip').removeClass('active active-button'); 2349 $('.tooltip-content').removeClass('active'); 2350 $(this).addClass('active active-button'); 2351 $(this).parents('.tooltip-content').addClass('active'); 2352 $(this).parents('.tooltip-content').children('.content').mouseleave(function () { 2353 $('.toggle-tooltip').removeClass('active active-button'); 2354 $('.tooltip-content').removeClass('active'); 2355 }); 2356 }); 2357 2358 2359 2360 } 2361 2362 2363 }); 2364 }; 2365 2366 var init3ColSlider = function () { 2367 const $threeColumnSlider = $('.three-column-slider'); 2368 if (!$threeColumnSlider.length) { 2369 return; 2370 } 2371 2372 $threeColumnSlider.slick({ 2373 slidesToShow: 1, 2374 slidesToScroll: 1, 2375 swipe: true, 2376 infinite: true, 2377 swipeToSlide: true, 2378 dots: true,
2379 arrows: false, 2380 autoplay: true, 2381 autoplaySpeed: 7000, 2382 fade: true, 2383 cssEase: 'linear' 2384 }); 2385 } 2386 2387 var runNonCritical = function (callback, timeout) { 2388 const maxWait = timeout || 2500; 2389 if ('requestIdleCallback' in window) { 2390 requestIdleCallback(callback, { timeout: maxWait }); 2391 return; 2392 } 2393 2394 window.addEventListener('load', function () { 2395 setTimeout(callback, 400); 2396 }, { once: true }); 2397 } 2398 2399 return { 2400 init: async function () { 2401 windowLoad(); 2402 windowScroll(); 2403 onWindowResize(); 2404 clickEvents(); 2405 chosenSelect('.chosen-select'); 2406 sameHeight('.mh'); 2407 sameHeightByRow('.mhbr'); 2408 initArticleSlider(); 2409 initBannerSlider(); 2410 initTestimonialSlider(); 2411 initTwoColSlider(); 2412 initNewsSlider(); 2413 initOtherHomesSlider(); 2414 initHalSlider(); 2415 initFESlider(); 2416 initSCSlider(); 2417 initFavouritesSlider(); 2418 initflexSlider(); 2419 runNonCritical(initRecentlyViewedSlider, 2000); 2420 runNonCritical(initTabcontrolSlider, 2000); 2421 runNonCritical(initInclusionsSlider, 2500); 2422 runNonCritical(init3ColSlider, 2500); 2423 initAccordion(); 2424 runNonCritical(initFeaturedEstatesSlider, 2500); 2425 initSalesCentreFacadeSlider(); 2426 uniteGallery("#facade-gallery"); 2427 uniteGallery("#images-gallery"); 2428 uniteGallery("#images-gallery-1"); 2429 uniteGallery("#video-gallery"); 2430 uniteGallery("#video-gallery-1"); 2431 isotopeInit('.isotope-items'); 2432 rangeSlider('#slider-house-size-range', [120, 300], 'm', 10); 2433 rangeSlider('#slider-block-width-range', [8, 34], 'm', 2); 2434 rangeSlider('#slider-block-depth-range', [8, 34], 'm', 2); 2435 rangeSlider('#slider-price-range', [120, 240], 'price', 10); 2436 rangeSlider('#slider-price-range-tablet', [120, 240], 'price', 10); 2437 rangeSlider('#slider-house-size-range-tablet', [120, 300], 'm', 10); 2438 rangeSlider('#slider-house-size-range-mobile', [120, 300], 'm', 10); 2439 rangeSlider('#slider-block-width-range-tablet', [8, 34], 'm', 2); 2440 rangeSlider('#slider-block-width-range-mobile', [8, 34], 'm', 2); 2441 rangeSlider('#slider-block-depth-range-tablet', [8, 34], 'm', 2); 2442 rangeSlider('#slider-block-depth-range-mobile', [8, 34], 'm', 2); 2443 rangeSlider('#slider-price-range-mobile', [120, 240], 'price', 10); 2444 2445 $('.display-centre-gallery').each((index, element) => uniteGallery('#' + element.id)); 2446 } 2447 } 2448 2449 })(jQuery, UIElement); 2450 2451 UIController.init(); 2452 2453})();
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.