// DETECT DEVICE $(window).bind('load resize', function() { // BROWSER CLASS if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { $("body").addClass("browser-safari"); } if (navigator.userAgent.match(/iP(hone|od|ad)/i)) { $("body").removeClass("browser-safari"); jQuery('body').addClass('browser-ios'); } // ADD PADDING TO TOP NAV IF CTA PRESENT ON LARGE SCREENS var ctaWidth = $('html:not([dir="rtl"]) nav.cta-links').outerWidth(); $('nav.secondary').css('padding-right', ctaWidth + 15); var ctaWidth = $('html[dir="rtl"] nav.cta-links').outerWidth(); $('nav.secondary').css('padding-left', ctaWidth + 5); }); // FIX PARALLAX // IE 11 background-attachment:fixed will jitter on scroll if this is missing jQuery(function() { if (navigator.userAgent.match(/MSIE 10/i) || navigator.userAgent.match(/Trident\/7\./) || navigator.userAgent.match(/Edge\/12\./)) { $('body').on("mousewheel", function() { event.preventDefault(); var wd = event.wheelDelta; var csp = window.pageYOffset; window.scrollTo(0, csp - wd); }); } }); // ADD CLASS TO HTML ELEMENT WHEN THE MOBILE/BURGER NAVIGATION IS PRESENT (function($) { var $window = $(window), $html = $('html'); function resize() { if ($window.width() < 992) { return $html.addClass('mobile-width'); } $html.removeClass('mobile-width'); } $window .resize(resize) .trigger('load resize'); })(jQuery); // IMPROVE SCROLL PERFORMANCE FOR // ANIMATION & // HEADER HIDE/REVEAL function debounce(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }; var myEfficientScroll = debounce(function() { // TRIGGER ANIMATIONS // http://www.oxygenna.com/tutorials/scroll-animations-using-waypoints-js-animate-css function onScrollInit(items, trigger) { items.each(function() { var osElement = $(this), osAnimationClass = osElement.attr('data-os-animation'), osAnimationDelay = osElement.attr('data-os-animation-delay'); osElement.css({ '-webkit-animation-delay': osAnimationDelay, '-moz-animation-delay': osAnimationDelay, '-ms-animation-delay': osAnimationDelay, 'animation-delay': osAnimationDelay }); var osTrigger = (trigger) ? trigger : osElement; osTrigger.waypoint(function() { osElement.addClass('animated').addClass(osAnimationClass); }, { //triggerOnce: true, offset: '95%' }); }); } onScrollInit($('.os-animation')); }, 250); window.addEventListener('load', myEfficientScroll); $(document).ready(function() { cookiePolicy(); $(".umbraco-ajax-form form").preventDoubleSubmission(); // LAZYSIZES PRELOAD $('img.lazyload').addClass('lazypreload'); // Main Navigation // $(".navigation nav.main ul li.active").addClass("mobile-open-child"); $(".navigation nav.main ul li span").click(function() { if ($(".navigation nav.main ul li span").length) { $(this).parent().toggleClass("open-child"); $(this).parent().siblings().removeClass("open-child"); $(this).parent().toggleClass("open-child_mobile"); $(this).parent().siblings().removeClass("open-child_mobile"); } else { $(this).parent().toggleClass("open-child"); $(this).parent().toggleClass("open-child_mobile"); } }); $(".navigation nav.main ul li.has-child.active").addClass("open-child_mobile"); $("html").click(function() { $(".navigation nav.main ul li.open-child").removeClass("open-child"); }); $(".navigation nav.main ul li span, header a.expand").click(function(e) { e.stopPropagation(); }); // EXPAND MOBILE NAVIVAGTION $("header#site-header a.expand").click(function() { if ($(".navigation .reveal").length) { $("header#site-header a.expand").toggleClass('active'); $("html").toggleClass('reveal-out'); } else { $("header#site-header a.expand").toggleClass('active'); $("html").toggleClass('reveal-out'); } }); // EXPAND Anchor Mobile Navigation $(".anchors-component .expand").click(function() { if ($(".anchors-component nav").length) { $(".anchors-component .expand").toggleClass('anchor-active'); $(".anchors-component nav").toggleClass('open-mobile'); } else { $(".anchors-component .expand").toggleClass('anchor-active'); $(".anchors-component nav").toggleClass('open-mobile'); } }); // EXPAND HEADER SEARCH $("header#site-header .site-search a.expand-search").click(function() { if ($("header#site-header .site-search").length) { $("header#site-header .site-search").toggleClass('open-search'); $("header#site-header .site-search .form-control").focus(); } else { $("header#site-header .site-search").toggleClass('open-search'); } }); $("html").click(function() { $("header#site-header .site-search").removeClass("open-search"); }); $("header#site-header .site-search").click(function(e) { e.stopPropagation(); }); //RTL for Slick function rtl_slick(){ if(jQuery("html").is('[dir="rtl"]')) { return true; } else { return false; }} // BANNER // PLAYS VIDEO IN BANNER $('.banner-component .slides').on('init', function(ev, el) { $('video').each(function() { //this.play(); }); }); // ALL CAROUSELS $(".component:not(.banner-component) .slides, footer#site-footer .slides").slick({ rtl: rtl_slick(), infinite: true, speed: 600, adaptiveHeight: true, prevArrow: '