"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: '×' } }); } })(); // REQUIRED TO SET ACTIVE ON THE CAROUSEL INDICATORS AS INDICATORS ARE OUTSIDE THE CAROUSEL $('#homepageHeroCarousel').on('slide.bs.carousel', function (e) { var slideFrom = $(this).find('.active').index(); var slideTo = $(e.relatedTarget).index(); // console.log("Slide has slid " + slideTo + " Is where we're going"); $(".homepage-carousel-indicators-block .carousel-indicators li").removeClass('active'); $(".homepage-carousel-indicators-block .carousel-indicators li").each(function( index ) { // console.log ( $(this).attr('data-slide-to') ); if( $(this).attr('data-slide-to') == slideTo ){ $(this).addClass('active'); } else { $(this).removeClass('active'); } }); }); // HOMEPAGE INFO BLOCKS OWL CAROUSEL $('.owl-carousel-3-grid').owlCarousel({ loop:true, margin:30, responsiveClass:true, nav:false, dots:false, responsive:{ 0:{ items:1, margin:20, stagePadding: 40 }, 768:{ items:3, margin:30, stagePadding: 0 } } }); /* $(function() { var owl = $('.owl-carousel-test'), owlOptions = { loop:true, margin:30, responsiveClass:true, nav:false, dots:false, responsive:{ 0:{ items:1, margin:20, stagePadding: 40 }, 768:{ items:3, margin:30, stagePadding: 0 } } }; if ( $(window).width() < 854 ) { var owlActive = owl.owlCarousel(owlOptions); } else { owl.addClass('off'); } $(window).resize(function() { if ( $(window).width() < 854 ) { if ( $('.owl-carousel-test').hasClass('off') ) { var owlActive = owl.owlCarousel(owlOptions); owl.removeClass('off'); } } else { if ( !$('.owl-carousel-test').hasClass('off') ) { owl.addClass('off').trigger('destroy.owl.carousel'); owl.find('.owl-stage-outer').children(':eq(0)').unwrap(); } } }); }); */ });