PageSourceSearch

https://www.nakheel.com/ResourcePackages/NakheelComponents/assets/src/assets/scripts/default.js?v=1

js nakheel.com collected 2026-10-02 04:47:43 UTC 12,798 bytes, 364 lines download raw bytes

1
2$(window).scroll(function () {
3    var scroll = $(window).scrollTop();
4
5    if (scroll >= 500) {
6        $(".scroll-top-btn").addClass("show");
7        $('.navbar').addClass('sticky-primary');
8    } else {
9        $(".scroll-top-btn").removeClass("show");
10        $('.navbar').removeClass('sticky-primary');
11    }
12    //if (MediaCenterGallery != undefined && MediaCenterGallery ) {  // media-centre
13    //    MediaCenterGallery.loadMoreItems()
14    //} else if (HotelResort != undefined && HotelResort) {// nakheel-experience/hospitality/hotels-resorts
15    //    HotelResort.loadMoreItems()
16    //} else if (RestaurantClub != undefined && RestaurantClub) {// nakheel-experience/leisure/restaurants-clubs
17    //    RestaurantClub.loadMoreItems()
18    //} else {// property-search
19    //    loadMoreItems()
20    //}
21});
22
23
24function equalizeParagraphHeights() {
25  var maxHeight = 0;
26  var $paragraphs = $(".swiper-slide .card.project-card .card-content p");
27
28  // Reset height first
29  $paragraphs.css("height", "auto");
30
31  // Find tallest
32  $paragraphs.each(function () {
33    var h = $(this).outerHeight();
34    if (h > maxHeight) {
35      maxHeight = h;
36    }
37  });
38
39  // Apply tallest to all
40  $paragraphs.height(maxHeight);
41}
42
43$(window).on("load resize", function () {
44  equalizeParagraphHeights();
45});
46
47$(document).ready(function () {
48
49    /* Section Title 2nd word to italic */
50    $('.title-outer .section-title, .mobileapp-section-new .title, .construction-desc-section .title-section .title, .location-section .map-outer .details .title, .visual-collection-section .title-outer .visual-title').each(function() {
51        let words = $(this).html().trim().split(" ");
52        if (words.length >= 2) {
53            words[1] = '<span class="italic-style">' + words[1] + '</span>';
54        }
55        $(this).html(words.join(" "));
56    });
57    $('.banner-section .banner-description .box-outer .box .desc, .banner-section .img-outer .banner-details .main-title').each(function() {
58        let words = $(this).html().trim().split(/\s+/); // split by any whitespace
59        for (let i = 1; i < words.length; i += 2) {
60            words[i] = '<span class="italic-style">' + words[i] + '</span>';
61        }
62        $(this).html(words.join(" "));
63    });
64
65
66    $('.construction-progress-section .nav-link').on('click', function () {
67        
68
69        //if ($(`.tab-content .tab-pane:nth-child(${$(this).index() + 1}) .desc`).length === 0) {
70        //    $(`.tab-content .tab-pane:nth-child(${$(this).index() + 1}) .construction-desc-section`).addClass('d-none')
71        //}
72        $(`.construction-desc-section .desc div`).removeClass('active')
73        $(`.construction-desc-section .desc div:nth-child(${$(this).index() + 1})`).addClass('active')
74    }); 
75    $(".sf_colsIn").each(function () {
76        if ($(this).html().trim() == "") { $(this).remove(); }
77    });
78
79    if ($("#HiddenSections").length >0) {
80        var hiddenSection = $("#HiddenSections").val();// "Latest CSR News Listing,Create Positive Impact Listing";
81        var elemArray = hiddenSection.split(',');
82
83        $.each(elemArray, function (index, value) {
84            var elem = $("[data-sf-element='" + value + "']");
85            if (elem.text().trim() === '') {
86                elem.closest('Section').hide();
87            }
88        });
89    }
90
91
92    // lazy loading plugin script starts here
93    $('.lazy').lazy({
94        delay: 500,
95        afterLoad: function (element) {
96            if (element.data("msrc")) {
97                if (window.screen.availWidth < 1025) {
98                    element.prop("src", element.data("msrc"));
99                }
100            }
101        }
102    });
103    // lazu loadiung plugin scripts ends here
104
105    // footer split menus script starts here
106    var bigHeight = $('.submenus');
107    var totalMenus = $('.parent');
108    $(totalMenus).children().each(function () {
109        var currentHeight = $(this).find(bigHeight).outerHeight(true);
110        if (currentHeight > 800) {
111            $(this).addClass('split-2');
112        } else if (currentHeight > 1200) {
113            $(this).addClass('split-3');
114        }
115
116    });
117    // footer split menus script starts here
118    // animation script starts here
119    AOS.init();
120    // scroll forcefully to bottom accordion collapse
121    $(document).on('footer shown.bs.collapse', function (event) {
122        if (event.target.getAttribute("id") == 'footerCollapseOne') {
123            event.target.scrollIntoView();
124        }
125    });
126    // scroll forcefully to bottom accordion collapse
127    // animation script ends here
128    $(".scroll-top-btn").on('click', function () {
129        $(window).scrollTop(0);
130    });
131
132    if (scroll >= 500) {
133        $(".scroll-top-btn").addClass("show");
134    } else {
135        $(".scroll-top-btn").removeClass("show");
136    }
137
138    $(".scroll-top-btn").on('click', function () {
139        $(window).scrollTop(0);
140    });
141
142    // filter search popup script starts here
143    $('document').on('click', '.btn-outline-grey', function () {
144        $('.btn-outline-grey.active').not(this).removeClass('active');
145        $(this).toggleClass('active');
146    })
147    $('document').on('click', '.filterToggle', function () {
148        $(this).toggleClass('active');
149        $('.filterToggle.active').not(this).removeClass('active');
150    })
151
152    $('.closeButton').on('click', function () {
153        $('.filterToggle').removeClass('active');
154    })
155    // filter search popup script ends here
156
157    // mobile menu scripts starts here
158
159    $('.navbar-toggler').on('click', function () {
160        $('.bottom-header').toggleClass('active')
161    })
162
163    $(document).on('click', '.mobileviewmenu .mega-title', function () {
164        $('.mobileviewmenu .mega-title').not(this).removeClass('active');
165        $('.mobileviewmenu .mega-title').not(this).next().removeClass('active');
166        $(this).toggleClass('active');
167        $(this).next().toggleClass('active');
168    })
169    $(document).on('click', '.mobileviewmenu .direct-link', function () {
170        $(this).next().removeClass('active');
171    })
172    $(document).on('click', '.mobileviewmenu .nav-link', function () {
173        $('.mobileviewmenu .nav-link').not(this).removeClass('active');
174        $('.mobileviewmenu .nav-link').not(this).next().removeClass('active');
175        $(this).toggleClass('active');
176        $(this).next().toggleClass('active');
177    });
178    $('.toggle-button').on('click', function () {
179        $('.header-section').toggleClass('show');
180    });
181
182    // filter search popup script starts here
183    $('.btn-outline-grey').on('click', function () {
184        $('.btn-outline-grey.active').not(this).removeClass('active');
185        $(this).toggleClass('active');
186    })
187    $('.filterToggle').on('click', function () {
188        $('.filterToggle.active').not(this).removeClass('active');
189        $(this).toggleClass('active');
190    })
191
192    $('.closeButton').on('click', function () {
193        $('.filterToggle').removeClass('active');
194    })
195    // filter search popup script ends here
196
197    // scroll to contact form section
198
199    $('.aminities-section .btn').on("click", function (e) {
200        e.preventDefault();
201        //$(e.target).attr("")
202        let topHeight = $('.registration-form-section').offset().top;
203        let hdrHeight = $('.header-section').height();
204        let totalHeight = topHeight - hdrHeight;
205        window.scrollTo({ top: totalHeight, behavior: 'smooth' });
206    });
207    // scroll to contact form section
208
209    // footer filter scroll functionality starts here
210    $(window).on('scroll', function () {
211        var filterHeight = $('.bottom-filter').height();
212        var scroll = $(window).scrollTop();
213
214        if (scroll >= filterHeight) {
215            $('.bottom-filter').addClass("fixToBottom");
216            $('.footer').css("margin-bottom", filterHeight);
217        } else {
218            $('.bottom-filter').removeClass("fixToBottom");
219        }
220    })
221    // footer filter scrol functionlaity ends here
222
223    // aminityslider script starts here
224    if ($(".aminity-swiper").length > 0) {
225        var swiperaminity = new Swiper(".aminity-swiper", {
226            slidesPerView: 2,
227            grid: {
228                rows: 2,
229                fill: "row"
230            },
231            spaceBetween: 0,
232            pagination: {
233                el: ".swiper-pagination-aminity",
234                clickable: true,
235            },
236            breakpoints: {
237                567: {
238                    slidesPerView: 2,
239                },
240                768: {
241                    slidesPerView: 3,
242                },
243                1024: {
244                    slidesPerView: 3,
245                    spaceBetween: 25,
246                },
247            },
248        });
249    }
250    // aminityslider script ends here
251
252    //Cookie Consent Show/Hide
253    if (checkCookie('NakheelCookieConsent')) {
254        $('.cookie-section').addClass('hide');
255    }
256    else {
257        $('.cookie-section').removeClass('hide');
258    }
259
260    var element = document.getElementById("accordionFlushExample");
261    if (element) {
262        var formHeight = element.offsetTop;
263        $('.accordion-header .btn').on('click', function () {
264            $('.contact-accordion-section .accordion-collapse').removeClass('show')
265            $('.contact-accordion-section .accordion-button').addClass('collapsed')
266            window.scrollTo(0, formHeight);
267        });
268    }
269
270
271    //mobile accordion collapse spqace correction script
272    $(".accordion-btn").on('click', function(){ 
273        $(this).parents('[data-sf-element="Row"]').toggleClass("collapse-main-parent") 
274    });
275    $(".mobile-collapse").on('click', function(){ 
276        $(this).parents('[data-sf-element="Row"]').toggleClass("collapse-main-parent") 
277    });
278    $(".collapse-btn").on('click', function(){ 
279        $(this).parents('[data-sf-element="Row"]').toggleClass("collapse-main-parent") 
280    });
281    
282});
283
284// broshure section video control script starts here
285var video = $("video");
286var videoStatus = video.get(0);
287
288$(".video").on('click', function () {
289
290    if (videoStatus.paused) {
291        video.trigger("play");
292        $(".play-icon").addClass('d-none')
293        this
294    } else {
295        video.trigger("pause");
296        $(".play-icon").removeClass('d-none')
297    }
298});
299
300$('.play-icon').on('click', function () {
301    video.trigger('click')
302})
303// broshure section video control scripts ends here
304
305//chat strat
306$(".chatIcon").on('click', function (event) {
307    event.preventDefault();
308    var liveChatUrl = $("#liveChatUrl").val();
309    openGlobalChatWindowNewWindow(liveChatUrl);
310});
311
312//Cookie Consent Popup
313$(".btn-cookie-consent").on('click', function (event) {
314    $('.cookie-section').addClass('hide');
315    setCookieWithoutExpiry("NakheelCookieConsent", "true");
316});
317
318
319function openGlobalChatWindowNewWindow(liveChatUrl) {
320    var width = 800; // specify the width of the new window
321    var height = 600; // specify the height of the new window
322    var resizable = 'no'; // specify if the window can be resized ('yes' or 'no')
323    var url = liveChatUrl;
324    var left = (window.innerWidth - width) / 2; // calculate the left position
325    var top = (window.innerHeight - height) / 2; // calculate the top position
326    var features = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ",resizable=" + resizable;
327
328    window.open(url, "_blank", features);
329}
330//chat ends
331
332// Function to set a cookie with no expiration date
333function setCookieWithoutExpiry(cookieName, cookieValue) {
334    var farFutureDate = new Date("9999-12-31T23:59:59");
335    var expires = "expires=" + farFutureDate.toUTCString();
336    document.cookie = cookieName + "=" + cookieValue + ";" + expires + ";path=/";
337}
338
339// Function to check if a cookie exists
340function checkCookie(cookieName) {
341    var cookies = document.cookie.split("; ");
342    for (var i = 0; i < cookies.length; i++) {
343        var cookie = cookies[i].split("=");
344        if (cookie[0] === cookieName) {
345            return true; // Cookie found
346        }
347    }
348    return false; // Cookie not found
349}
350
351function scrollToElement(elementId, topSpacing) {
352    var targetElement = document.getElementById(elementId);
353
354    if (targetElement) {
355        var targetPosition = targetElement.getBoundingClientRect().top + window.scrollY;
356        var scrollToPosition = targetPosition - topSpacing;
357
358        // Scroll smoothly to the target position
359        window.scrollTo({
360            top: scrollToPosition,
361            behavior: 'smooth'
362        });
363    }
364}

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.