document.addEventListener("DOMContentLoaded", function (event) { // Page scroll using url params let url = new URL(window.location.href); if (url.searchParams.has('sitelink')) { const sitelink = url.searchParams.get('sitelink'); window.location.href += '#' + sitelink; } // Auto Enquiry Modal //if (window.innerWidth > 800) { setTimeout(function(){ $('#enqModal').modal('show') }, 5000); } // PP Iframe let ppIframeURL = "https://www.propertypistol.com/aboutus/"; $('.ppiframebtn').on('click', () => { $(".pp-iframe").attr("src", ppIframeURL); }); $('#ppiframe').on('hide.bs.modal', function (event) { $(".pp-iframe").attr("src",""); }); // Slider Config $(".carousel-inner .carousel-item").first().addClass("active"); // Tab Config $("#pills-tab-pricetable .nav-link").first().addClass("active"); $("#pills-tabpriceContent .tab-pane").first().addClass("show active"); $("#pills-tab-floorplan .nav-link").first().addClass("active"); $("#pills-tabfloorplanContent .tab-pane").first().addClass("show active"); $("#pills-tabami .nav-link").first().addClass("active"); $("#pills-tabamiContent .tab-pane").first().addClass("show active"); $("#pills-tabgal .nav-link").first().addClass("active"); $("#pills-tabgalContent .tab-pane").first().addClass("show active"); $("#pills-tabconn .nav-link").first().addClass("active"); $("#pills-tabconnContent .tab-pane").first().addClass("show active"); // User Inactivity Enquiry Modal /* var interval; $(document).on('mousemove keyup keypress', function () { clearTimeout(interval); settimeout(); }); function settimeout() { interval = setTimeout(function () { $('#enqModal').modal('show'); }, 30000) } */ // Slider $('.ami-2').owlCarousel({ autoplay: true, lazyLoad: true, loop: false, rewind: true, margin: 10, responsiveClass: true, smartSpeed: 800, nav: true, dots: false, responsive: { 0: { items: 1 }, 600: { items: 3 }, 1000: { items: 5 } } }); $('.ami-3').owlCarousel({ autoplay: true, lazyLoad: true, loop: false, rewind: true, margin: 20, responsiveClass: true, smartSpeed: 1000, nav: true, dots: false, responsive: { 0: { items: 1, nav: false, }, 768: { items: 2, mouseDrag: false, } } }); $('.ami-4').owlCarousel({ autoplay: true, lazyLoad: true, loop: false, rewind: true, margin: 20, responsiveClass: true, smartSpeed: 1000, nav: true, dots: false, responsive: { 0: { items: 1, nav: false, }, 768: { items: 3, mouseDrag: false, } } }); $('.gal-3').owlCarousel({ autoplay: true, lazyLoad: true, loop: false, rewind: true, margin: 20, responsiveClass: true, smartSpeed: 1500, nav: true, dots: false, items: 1 }); $('.loc-con').owlCarousel({ autoplay: true, lazyLoad: true, loop: false, rewind: true, margin: 0, responsiveClass: true, smartSpeed: 800, nav: true, dots: false, responsive: { 0: { items: 1 }, 600: { items: 2 }, 1000: { items: 4 } } }); }); // Navigation $('.navbar-nav>li>a').on('click', function () { $('.navbar-collapse').collapse('hide'); }); // Enquiry Modal $('.enqModal').click(function () { var Type = $(this).data("form"); var Title = $(this).data("title"); var Btn = $(this).data("btn"); if ($(this).data("redirect")) { var RedirectCookie = $(this).data("redirect"); if (RedirectCookie == 'brochure' || RedirectCookie == 'pricesheet') { var RedirectFileCookie = $(this).data("redirect-file"); } } else { var RedirectCookie = "enquire"; } var Enquiry = $(this).data("enquiry"); $('#enqModal .modal-title').html(Title); $('#enqModal .micro-form-btn').text(Btn); $('#enqModal #enquireName').val(Enquiry); if (Type == "sm" || Type == "md" || Type == "lg") { $('#enqModal .modal-head').removeClass('d-none'); $('#enqModal .modal-logo, #enqModal .form-md, #enqModal .form-lg, #enqModal .modal-call-btn, .auto-offer').addClass('d-none'); } if (Type == "sm") { $("#enqModal .form-md .micro-form-field").removeAttr("required", ""); } if (Type == "md") { $('#enqModal .modal-head, #enqModal .form-md').removeClass('d-none'); $('#enqModal .form-lg').addClass('d-none'); $("#enqModal .form-md .micro-form-field").attr("required", ""); } if (Type == "lg") { $('#enqModal .modal-head, #enqModal .form-md, #enqModal .form-lg').removeClass('d-none'); $("#enqModal .form-md .micro-form-field").attr("required", ""); } if (RedirectCookie) { setCookie('redirectCookie', RedirectCookie); if (RedirectCookie == 'brochure') { setCookie('redirectFileCookie', RedirectFileCookie); $('#modalRBEnq').addClass('d-none'); $('#modalRBEnqBro').removeClass('d-none'); $('#modalRBEnqCol').removeClass('col-md-4'); $('#modalRBEnqCol').addClass('col-md-5'); $('#enqModal .modal-dialog.enq-modal').addClass('enq-modal-bro'); } else { $('#modalRBEnqBro').addClass('d-none'); $('#modalRBEnq').removeClass('d-none'); $('#modalRBEnqCol').removeClass('col-md-5'); $('#modalRBEnqCol').addClass('col-md-4'); $('#enqModal .modal-dialog.enq-modal').removeClass('enq-modal-bro'); } if (RedirectCookie == 'pricesheet') { setCookie('redirectFileCookie', RedirectFileCookie); } } }); // Load International Telephone Input $('form :input[name=mobile]').each(function () { $(this).intlTelInput({ initialCountry: countryCode, preferredCountries: ["in"] }); }); $(".intTelInput").keyup(function () { var intTelInputId = $(this).attr("id"); var contryCode = $('#' + intTelInputId).intlTelInput('getSelectedCountryData').dialCode; var mobileNo = $('#' + intTelInputId).val(); if (contryCode == null) { $(':input[name=fullMobileNo]').val(mobileNo); } else { $(':input[name=fullMobileNo]').val('+' + contryCode + mobileNo); } }); // Cookies function setCookie(cname, cvalue) { var d = new Date(); d.setTime(d.getTime() + (1 * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } // Read more $('.more').click(function (e) { e.preventDefault(); $(this).text(function (i, t) { return t == 'Read less' ? 'Read more' : 'Read less'; }).prev('.more-cont').slideToggle() }); // Virtual Tour Iframe - Enquiry const vtIframeEnquiry = (e, src, sec = 5) => { if (src) { $(e).empty().append(''); $timeOut = (sec * 1000) + 2000; setTimeout(() => { $('#enqModal').modal('show'); $(e).addClass('block-iframe'); }, $timeOut); } }