"use strict"; $(function () { // Main navigation dropdown on hover instead of click. (function () { /* Update default Bootstrap configuration to trigger dropdowns on hover instead of click */ function toggleDropdown(e) { var $dropdown = $(e.target).closest('.dropdown'), $menu = $('.dropdown-menu', $dropdown); setTimeout(function () { var shouldOpen = e.type !== 'click' && $dropdown.is(':hover'); $menu.toggleClass('show', shouldOpen); $dropdown.toggleClass('show', shouldOpen); $('[data-toggle="dropdown"]', $dropdown).attr('aria-expanded', shouldOpen); }, e.type === 'mouseleave' ? 300 : 0); } $('body').on('mouseenter mouseleave', '.dropdown', toggleDropdown).on('click', '.dropdown-menu a', toggleDropdown); document.addEventListener('scroll', function (event) { $('#page-home').toggleClass('scrolled', window.scrollY > 500); }, { passive: true }); })(); // Homepage "Quick Links" carousel (function () { var $carousel = $('.quick-links-carousel'); if (!$carousel.length) { return; } $carousel.slick({ arrows: false, mobileFirst: true, variableWidth: true, dots: true, responsive: [{ breakpoint: 767, settings: "unslick" }] }); $(window).on('resize', function () { return $carousel.slick('resize'); }); })(); // Homepage "Quick Links" auto-scroll (function () { $('a.slow-jump').on('click touch', function (event) { var jumpDistanceModifier = $(this).attr('data-jump-distance-mod'); console.log("jump" + jumpDistanceModifier); if(jumpDistanceModifier > 0){ $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top - jumpDistanceModifier }, 500); } else { $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top }, 500); } }); })(); // Availability page multi-tab target (function () { /* Bootstrap does not support multiple target elements for tabs and the collapsible component would allow "tabs" to be closed, leaving the page looking broken. */ $(document).on('shown.bs.tab', '#availability-locator', function (event) { var $targetElements = $($(event.target).attr('data-target')); $($targetElements.attr('data-parent')).find('.tab-pane').removeClass('active'); $targetElements.addClass('active'); }); })(); // Travel page mobile carousel (function () { var $carousel = $('#travel-connectivity .nav-tabs'); if (!$carousel.length) { return; } $carousel.on('show.bs.tab', function (event) { $(event.target).parents('.slick-track').find('.nav-link').removeClass('active'); }); $carousel.on('afterChange', function (event, slick) { var $currentTab = $carousel.find("[data-slick-index=\"".concat($carousel.slick('slickCurrentSlide'), "\"]")).children('.nav-link'); $currentTab.tab('show'); }); $carousel.slick({ arrows: false, mobileFirst: true, variableWidth: true, autoplay: false, focusOnSelect: true, centerMode: true, dots: true, responsive: [{ breakpoint: 767, settings: "unslick" }] }); $(window).on('resize', function () { return $carousel.slick('resize'); }); })(); // Local area expanding images (function () { $('#local-area-info .expand a').on('click', function (event) { event.preventDefault(); event.stopPropagation(); var $collapseQueue; var $parentGroup = $($(this).parents('.local-area-gallery')); switch ($(this).attr('aria-expanded')) { case 'true': $collapseQueue = $parentGroup.find('.collapse.show'); $collapseQueue.last().collapse('hide'); $([document.documentElement, document.body]).animate({ scrollTop: $(this).offset().top - $(window).height() }); if ($collapseQueue.length === 1) { $(this).text('+'); $(this).attr('aria-expanded', 'false'); } break; case 'false': $collapseQueue = $parentGroup.find('.collapse:not(.show)'); $collapseQueue.first().collapse('show'); $([document.documentElement, document.body]).animate({ scrollTop: $collapseQueue.first().offset().top - 200 }); if ($collapseQueue.length === 1) { $(this).text('-'); $(this).attr('aria-expanded', 'true'); } } }); })(); // Gallery page image litebox (function () { if (typeof Litebox !== 'undefined') { new Litebox({ target: 'data-img-src', labels: { close: '×' } }); } })(); });