// var gClickFlag = false; var gResizeInitCount = 0; function veo_commonInit() { var gIsAutoPlay = true; $.each($(".topSlider .sliderItem"), function(_i, _el){ if($(_el).find('.videoWrapper').data("video") !== undefined){ gIsAutoPlay = false; } }); $(".topSlider").slick ( { dots: true, infinite: true, speed: 300, slidesToShow: 1, adaptiveHeight: true, fade: true, autoplay: gIsAutoPlay, autoplaySpeed: 5000 } ); $(".topSlider").on ( "beforeChange", function(pEvent, pSlick, pCurrentSlide, pNextSlide) { var _video = $(".topSlider").find(".sliderItem[data-slick-index=" + pNextSlide + "]").find(".videoWrapper").data("video"); $(".topSlider").find(".sliderItem").removeClass("active"); $(".topSlider").find(".sliderItem[data-slick-index=" + pNextSlide + "]").addClass("active"); updateSliderVideo($(".topSlider"), $(".topSlider").find(".sliderItem[data-slick-index=" + pNextSlide + "]"), _video); } ); /* $(".topSlider").on ( "afterChange", function(pEvent, pSlick, pCurrentSlide) { } ); */ $(".topSlider").find(".sliderItem").removeClass("active"); $(".topSlider").find(".sliderItem[data-slick-index=0]").addClass("active"); updateSliderVideo($(".topSlider"), $(".topSlider").find(".sliderItem.active"), $(".topSlider").find(".sliderItem.active").find(".videoWrapper").data("video")); $(window).on ( "resize", function(pEvent, pResponsive_str) { gResizeInitCount++; if ((gResizeInitCount < 2) || ($(window).width() != gDisplayWidth)) { gDisplayWidth = $(window).width(); $("html, body").removeClass("transitionFreeze").addClass("transitionFreeze"); if(gCurrentTab != '') { updateTabMenu(gCurrentTab); } if ($(".campusMenuWrapper").length > 0) { updateCampusMenu($(".campusMenuWrapper").find("#")); } if ($(".learningwithusMenuWrapper").length > 0) { updateLearningwithusMenu($(".learningwithusMenuWrapper").find("#")); } if ($(".tabMenuWrapper").length > 0) { if(gCurrentTab != '') { updateTabMenu(gCurrentTab); } // 20180115 call closeFaqItems() only when it is declared if (typeof closeFaqItems !== 'undefined' && typeof closeFaqItems === 'function') { closeFaqItems(); } } setTimeout ( function () { $("html, body").removeClass("transitionFreeze"); }, 10 ); } } ); } function veo_campusInit() { $(".campusMenu").find("input[type='radio']").on ( "change", function (pEvent) { updateCampusMenu($(pEvent.currentTarget)); } ); gDisplayWidth = $(window).width(); gCurrentCampusSection = $(".campusMenuWrapper").find("#").val(); $(".campusMenuWrapper").find("#").trigger("click"); updateCampusMenu($(".campusMenuWrapper").find("#")); } function veo_learningwithusInit() { $(".learningwithusMenu").find("input[type='radio']").on ( "change", function (pEvent) { updateLearningwithusMenu($(pEvent.currentTarget)); } ); gDisplayWidth = $(window).width(); gCurrentLearningwithusSection = $(".learningwithusMenuWrapper").find("#").val(); $(".learningwithusMenuWrapper").find("#").trigger("click"); } function updateSliderVideo(pSlider, pSliderItem, pVideo) { var _html = null; var _popVideoType = pSliderItem.data("type"); var _popVideo = pSliderItem.data("id"); _html = ''; if (pVideo != undefined) { if ($("body").hasClass("deviceDesktop")) { _html += ''; } } if ((_popVideoType != undefined) && (_popVideoType != "")) { _html += ''; } pSliderItem.find(".videoWrapper").html(_html); } function tabMenuInit(pTabId) { $(".tabMenu").find("input[type='radio']").on ( "change", function (pEvent) { updateTabMenu($(pEvent.currentTarget)); } ); $(".tabMenuWrapper").find("#" + pTabId).trigger("click"); } function toggleTabMenu() { if ($(".tabMenuBtn").hasClass("active")) { closeTabSelection(); $(".tabMenuBtn").html($(".tabMenu").find("input[type='radio']:checked").data("desc")); } else { closeTabSelection(); $(".tabMenuBtn").addClass("active"); $(".tabMenu").css({"margin-top": 0}); $(".tabMenuBtn").html("Select section:"); } } function updateTabMenu(pTarget) { var _isInit = false; if ((gCurrentTab == undefined) || (gCurrentTab == null) || (gCurrentTab == "")) { _isInit = true; } gCurrentTab = pTarget; closeTabSelection(); $(".tabMenuBtn").html(pTarget.data("desc")); $(".tabItem").css({"opacity": 0, "z-index": -1}); $(".tabItem." + pTarget.val()).css({"opacity": 1, "z-index": 1}); $(".tabWrapper").css({"height": $(".tabItem." + pTarget.val()).height() + "px"}); if (!_isInit) { setTimeout ( function () { doPageScroll($(".tabMenuWrapper")); }, 100 ); } } function closeTabSelection() { $(".tabMenuBtn").removeClass("active"); $(".tabMenu").css({"margin-top": (-1 * $(".tabMenu").height()) + "px"}); }