jQuery(function($){ $(document).ready(function(){ var inwb_main_carousel = $('#inwb_main_carousel'); inwb_main_carousel.on('init', function(event, slick){ var elSlide = $(slick.$slides[0]); var mode = ""; if (matchMedia("(min-width: 1200px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('xlMode'); }else if (matchMedia("(min-width: 960px) and (max-width: 1199px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('lMode'); }else if (matchMedia("(min-width: 768px) and (max-width: 959px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('mMode'); }else if (matchMedia("(min-width: 576px) and (max-width: 767px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('sMode'); }else if (matchMedia("(max-width: 575px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('xsMode'); } $("#header, #inwb_main_carousel_cont") .removeClass("light") .removeClass("dark") .addClass(mode); var inwb_main_carousel_nav_item_html = ''; $(slick.$slides).each(function( index ) { inwb_main_carousel_nav_item_html += ''; }); $("#inwb_main_carousel_cont .inwb_main_carousel_nav").html(inwb_main_carousel_nav_item_html); $("#inwb_main_carousel_cont .inwb_main_carousel_nav").find("[data-index='0']").addClass("active"); /*if(window.dataLayer){ ga_EA = elSlide.find('.inwb_main_carousel_item').data('gaea'); ga_EL = elSlide.find('.inwb_main_carousel_item').data('gael'); dataLayer.push({'event': 'newCarouselImpression', 'ec': 'newCarousel – impression', 'ea': ga_EA, 'el': ga_EL}); }*/ if (elSlide.find('.inwb_main_carousel_item').hasClass('inwb_main_carousel_video_item')){ var video_el = elSlide.find('video'); var video_path = video_el.attr('poster').substr(0,video_el.attr('poster').lastIndexOf("/") + 1); if (matchMedia("(min-width: 1200px)").matches) { video_el.attr('poster', video_path+'bg_05_XL.jpg'); video_el.attr('src', video_path+'1920x532-a.mp4'); video_el.attr('class', 'normal-bg-video xl-normal-video-bg'); }else if (matchMedia("(min-width: 960px) and (max-width: 1199px)").matches) { video_el.attr('poster', video_path+'bg_04_L.jpg'); video_el.attr('src', video_path+'1440x532-a.mp4'); video_el.attr('class', 'normal-bg-video l-normal-video-bg'); }else if (matchMedia("(min-width: 768px) and (max-width: 959px)").matches) { video_el.attr('poster', video_path+'bg_03_M.jpg'); video_el.attr('src', video_path+'1024x532-a.mp4'); video_el.attr('class', 'normal-bg-video m-normal-video-bg'); }else if (matchMedia("(min-width: 576px) and (max-width: 767px)").matches) { video_el.attr('poster', video_path+'bg_02_S.jpg'); video_el.attr('src', video_path+'768x496-a.mp4'); video_el.attr('class', 'normal-bg-video s-normal-video-bg'); }else if (matchMedia("(max-width: 575px)").matches) { video_el.attr('poster', video_path+'bg_01_XS.jpg'); video_el.attr('src', video_path+'576x496-a.mp4'); video_el.attr('class', 'normal-bg-video xs-normal-video-bg'); } } var bodySelector = $('body'); var menuColor = elSlide.find('.inwb_main_carousel_item').data('menuColor'); if (menuColor === "dark") { bodySelector.removeClass('frameconfig-navbar--dark') bodySelector.addClass('frameconfig-navbar--light'); } else if (menuColor === "light") { bodySelector.removeClass('frameconfig-navbar--light') bodySelector.addClass('frameconfig-navbar--dark'); } }); slideTime = 6000; if (matchMedia("(min-width: 1200px)").matches) { slideTimeObject = inwb_main_carousel.find('.inwb_main_carousel_item:first-of-type').data('xlSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } }else if (matchMedia("(min-width: 960px) and (max-width: 1199px)").matches) { slideTimeObject = inwb_main_carousel.find('.inwb_main_carousel_item:first-of-type').data('lSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } }else if (matchMedia("(min-width: 768px) and (max-width: 959px)").matches) { slideTimeObject = inwb_main_carousel.find('.inwb_main_carousel_item:first-of-type').data('mSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } }else if (matchMedia("(min-width: 576px) and (max-width: 767px)").matches) { slideTimeObject = inwb_main_carousel.find('.inwb_main_carousel_item:first-of-type').data('sSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } }else if (matchMedia("(max-width: 575px)").matches) { slideTimeObject = inwb_main_carousel.find('.inwb_main_carousel_item:first-of-type').data('xsSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } } inwb_main_carousel.slick({ arrows: false, dots: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: slideTime, speed: 500, pauseOnFocus: false, pauseOnHover: false, pauseOnDotsHover: false, responsive: [ { breakpoint: 576, settings: { arrows: true, } }, ] }); timerAnimTime = slideTime + 500 + "ms"; $("#inwb_main_carousel_cont .inwb_main_carousel_nav").find("[data-index='0']").find(".inwb_main_carousel_nav_item_timer").css("animation-duration",timerAnimTime); inwb_main_carousel.on('beforeChange', function(event, slick, currentSlide, nextSlide){ var elSlide = $(slick.$slides[nextSlide]); var mode = ""; var bodySelector = $('body'); var menuColor = elSlide.find('.inwb_main_carousel_item').data('menuColor'); /*if (menuColor === "dark") { bodySelector.removeClass('frameconfig-menucolor--light frameconfig-menubg--transparent frameconfig-navbar--dark frameconfig-menuwrapper--lightblur') bodySelector.addClass('frameconfig-menucolor--dark frameconfig-menubg--transparent frameconfig-navbar--light frameconfig-menuwrapper--darkblur'); } else if (menuColor === "light") { bodySelector.removeClass('frameconfig-menucolor--dark frameconfig-menubg--transparent frameconfig-navbar--light frameconfig-menuwrapper--darkblur') bodySelector.addClass('frameconfig-menucolor--light frameconfig-menubg--transparent frameconfig-navbar--dark frameconfig-menuwrapper--lightblur'); }*/ if (menuColor === "dark") { bodySelector.removeClass('frameconfig-navbar--dark') bodySelector.addClass('frameconfig-navbar--light'); } else if (menuColor === "light") { bodySelector.removeClass('frameconfig-navbar--light') bodySelector.addClass('frameconfig-navbar--dark'); } if (matchMedia("(min-width: 1200px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('xlMode'); }else if (matchMedia("(min-width: 960px) and (max-width: 1199px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('lMode'); }else if (matchMedia("(min-width: 768px) and (max-width: 959px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('mMode'); }else if (matchMedia("(min-width: 576px) and (max-width: 767px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('sMode'); }else if (matchMedia("(max-width: 575px)").matches) { mode = elSlide.find('.inwb_main_carousel_item').data('xsMode'); } $("#header, #inwb_main_carousel_cont") .removeClass("light") .removeClass("dark") .addClass(mode); $("#inwb_main_carousel_cont .inwb_main_carousel_nav").find("[data-index='" + currentSlide + "']").removeClass("active"); $("#inwb_main_carousel_cont .inwb_main_carousel_nav").find("[data-index='" + nextSlide + "']").addClass("active"); slideTime = 6000; var elSlide = $(slick.$slides[nextSlide]); if (matchMedia("(min-width: 1200px)").matches) { slideTimeObject = elSlide.find('.inwb_main_carousel_item').data('xlSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } }else if (matchMedia("(min-width: 960px) and (max-width: 1199px)").matches) { slideTimeObject = elSlide.find('.inwb_main_carousel_item').data('lSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } }else if (matchMedia("(min-width: 768px) and (max-width: 959px)").matches) { slideTimeObject = elSlide.find('.inwb_main_carousel_item').data('mSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } }else if (matchMedia("(min-width: 576px) and (max-width: 767px)").matches) { slideTimeObject = elSlide.find('.inwb_main_carousel_item').data('sSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } }else if (matchMedia("(max-width: 575px)").matches) { slideTimeObject = elSlide.find('.inwb_main_carousel_item').data('xsSlidetime'); if (typeof slideTimeObject !== 'undefined') { if (slideTimeObject) { slideTime = slideTimeObject; } } } inwb_main_carousel.slick("setOption", "autoplaySpeed", slideTime); timerAnimTime = slideTime + slick.options.speed + "ms"; $("#inwb_main_carousel_cont .inwb_main_carousel_nav").find("[data-index='" + nextSlide + "']").find(".inwb_main_carousel_nav_item_timer").css("animation-duration",timerAnimTime); /*if(window.dataLayer){ ga_EA = elSlide.find('.inwb_main_carousel_item').data('gaea'); ga_EL = elSlide.find('.inwb_main_carousel_item').data('gael'); dataLayer.push({'event': 'newCarouselImpression', 'ec': 'newCarousel – impression', 'ea': ga_EA, 'el': ga_EL}); }*/ }); inwb_main_carousel.on('afterChange', function(event, slick, currentSlide){ }); inwb_main_carousel.on('swipe', function(event, slick, direction){ inwb_main_carousel.slick("slickPause"); $("#inwb_main_carousel_cont").addClass("autoPlayStopped"); }); $("#inwb_main_carousel_cont .inwb_main_carousel_nav_item").on("click", function(){ $("#inwb_main_carousel_cont .inwb_main_carousel_nav_item").each(function() { $(this).removeClass("active"); }); $(this).addClass("active"); slider_index = $(this).data("index"); inwb_main_carousel.slick("slickGoTo", slider_index, false); inwb_main_carousel.slick("slickPause"); $("#inwb_main_carousel_cont").addClass("autoPlayStopped"); }); $("#inwb_main_carousel_cont .slick-arrow").on("click", function(){ inwb_main_carousel.slick("slickPause"); $("#inwb_main_carousel_cont").addClass("autoPlayStopped"); }); /*$( "a.slideClickedPushGA" ).click(function( event ) { if(window.dataLayer){ ga_EA = $(this).closest('.inwb_main_carousel_item').data('gaea'); ga_EL = $(this).attr('href'); dataLayer.push({'event': 'newCarouselClick', 'ec': 'newCarousel – click', 'ea': ga_EA, 'el': ga_EL}); } });*/ }); $(window).resize(function () { $(".inwb_main_carousel_video_item").each(function() { var video_el = $(this).find('video'); var video_path = video_el.attr('poster').substr(0,video_el.attr('poster').lastIndexOf("/") + 1); if (matchMedia("(min-width: 1200px)").matches) { video_el.attr('poster', video_path+'bg_05_XL.jpg'); video_el.attr('src', video_path+'1920x532-a.mp4'); video_el.attr('class', 'normal-bg-video xl-normal-video-bg'); }else if (matchMedia("(min-width: 960px) and (max-width: 1199px)").matches) { video_el.attr('poster', video_path+'bg_04_L.jpg'); video_el.attr('src', video_path+'1440x532-a.mp4'); video_el.attr('class', 'normal-bg-video l-normal-video-bg'); }else if (matchMedia("(min-width: 768px) and (max-width: 959px)").matches) { video_el.attr('poster', video_path+'bg_03_M.jpg'); video_el.attr('src', video_path+'1024x532-a.mp4'); video_el.attr('class', 'normal-bg-video m-normal-video-bg'); }else if (matchMedia("(min-width: 576px) and (max-width: 767px)").matches) { video_el.attr('poster', video_path+'bg_02_S.jpg'); video_el.attr('src', video_path+'768x496-a.mp4'); video_el.attr('class', 'normal-bg-video s-normal-video-bg'); }else if (matchMedia("(max-width: 575px)").matches) { video_el.attr('poster', video_path+'bg_01_XS.jpg'); video_el.attr('src', video_path+'576x496-a.mp4'); video_el.attr('class', 'normal-bg-video xs-normal-video-bg'); } }); }); });