/* ******************************************************* * filename : main.js * description : 准旍澑�愲 �毄�橂姅 JS * date : 2020-02-24 ******************************************************** */ jQuery(function ($) { /* *********************** 准旍澑 Fullpage ************************ */ if (detectBrowser() === "Firefox" || "chrome" || detectBrowser() === "18.1") { scrollState = true; } else { scrollState = false; } $('#fullpage').fullpage({ css3: true, fitToSection: false, navigation: true, scrollBar: scrollState, navigationPosition: 'right', navigationTooltips: ['', '', '', ''], responsiveWidth: 1024, onLeave: function (index, nextIndex, direction) { if (nextIndex == 2) { setTimeout(function () { $("#mainBusinessContent").addClass("scroll-active-animate"); $('.main-business-list-con').slick("play"); }, 600); } else if (nextIndex == 3) { setTimeout(function () { $("#mainShowroomContent").addClass("scroll-active-animate"); }, 400); } else if (nextIndex == 4) { setTimeout(function () { $("#mainRelationContent").addClass("scroll-active-animate"); $('.relation-list-con > ul').slick("play"); }, 400); } // �检leftBar �夓儊氤�瓴� if (nextIndex > 2) { $("#fp-nav").addClass("black"); } else { $("#fp-nav").removeClass("black"); } } }); /* *********************** 准旍澑 牍勳<�� ************************ */ // 准旍澑 牍勳<�� �掛澊臧� �れ爼 if ($.exists('#mainVisual.full-height')) { mainVisualHeight(); $(window).on('resize', mainVisualHeight); function mainVisualHeight() { var visual_height = getWindowHeight() - $("#header").height(); // header臧� fixed or absolute�缄步�� - $("#header").height() ��牅 if (getWindowWidth() > 800) { $("#mainVisual").height(visual_height); } else { $("#mainVisual").css("height", "auto"); } } } // 准旍澑 牍勳<�� �澕�措摐 /* var $mainVisualItem = $(".main-visual-con"); $mainVisualItem.on('init', function(event, slick) { $(".main-visual-item").eq(0).addClass("active-item"); }); $mainVisualItem.on('beforeChange', function(event, slick, currentSlide, nextSlide) { $(".main-visual-item").removeClass("active-item"); $(this).find(".main-visual-item").eq(nextSlide).addClass("active-item") }); $mainVisualItem.slick({ slidesToShow: 1, slidesToScroll: 1, arrows: false, fade: true, dots:true, autoplay: true, speed:0, infinite:true, autoplaySpeed: 4000, easing: 'easeInOutQuint', pauseOnHover:false, zIndex:1 }); */ /* *********************** 准旍澑 牍勳<�� �澕�措摐 ************************ */ // 准旍澑 牍勳<�� �澕�措摐 var $visualWrapper = $("#mainVisual"); var $visualList = $visualWrapper.find(".main-visual-item"); var $txtList = $(".visual-txt-item"); var $bulletList = $(".main-visual-paging > span"); var visualLength = $visualList.length; var visualIndex = 0; var visualSpeed = 5000; var isClick = 0; $visualList.each(function () { var $divideItem = $(this).find(".sub-visual-bg-box"); var bgSrc = $divideItem.data("img-src"); for (var i = 0; i < 5; i++) { $divideItem.append("
"); } }); setTimeout(function () { $visualWrapper.addClass("active-item"); }); /* First item add Active */ $visualList.eq(visualIndex).addClass("active-item").css({ "visibility": "visible" }).find(".main-visual-m-img").addClass("active-item"); var $firstVisual = $visualList.eq(visualIndex).find(".visual-intro-bg"); if (detectBrowser() === "Firefox" || detectBrowser() === "18.1") { $visualWrapper.addClass("no-gsap"); $firstVisual.animate({ "width": "100%", "opacity": "1.0" }, 800, "easeInQuart"); } else { TweenMax.set(".visual-intro-bg span", { transformOrigin: "left 0%" }); TweenMax.from($firstVisual, 0.8, { width: "0px", opacity: 0, ease: Power2.easeInOut }) } // $txtList.eq(visualIndex).addClass("active-item"); // $txtList.eq(visualIndex).find(".main-visual-txt-inner").css("transition","opacity 0.5s ease 1s, transform 0.5s ease 1s"); $bulletList.eq(visualIndex).addClass("active-item"); /* Loop Active */ var visual_timer = setInterval(function () { visualPlay(); }, visualSpeed) /* After Slide And Next Active */ function slideChangeAction(visualIndex) { setTimeout(function () { $visualList.removeClass("active-item"); $visualList.eq(visualIndex).addClass("active-item").removeClass("next-active").removeAttr('style'); setTimeout(function () { isClick = 0; }, 20); }, 2000); } /* After Slide And Reset Prev Active Image */ function resetVisual() { setTimeout(function () { $(".main-visual-item.active-item").find(".visual-intro-bg").removeAttr('style'); }, 2000); $(".main-visual-item.active-item").find(".main-visual-m-img").removeClass("active-item"); // $txtList.removeClass("active-item"); $bulletList.removeClass("active-item"); } /* Visual Index Check */ function visualNextCheck(visualIndex, check) { resetVisual(); switch (check) { case 'prev': if (visualIndex >= 0) { visualIndex = (visualIndex === 0) ? visualLength - 1 : visualIndex - 1; } break; case 'bullet': visualIndex = visualIndex + 1; break; default: visualIndex = (visualIndex >= (visualLength - 1)) ? visualIndex = 0 : visualIndex += 1; } activeAndNextActive(visualIndex); return visualIndex; } /* Visual Active */ function activeAndNextActive(visualIndex) { $visualList.eq(visualIndex).addClass("next-active").css({ "visibility": "visible", "z-index": "12" }).find(".main-visual-m-img").addClass("active-item"); var $curVisual = $visualList.eq(visualIndex).find(".visual-intro-bg"); // $visualList.eq(visualIndex).find(".visual-intro-bg").animate({"width":"100%","opacity":"1.0"},700,"easeOutQuart"); if (detectBrowser() === "Firefox" || detectBrowser() === "18.1") { $curVisual.animate({ "width": "100%", "opacity": "1.0" }, 800, "easeInQuart"); } else { TweenMax.from($curVisual, 0.8, { width: "0px", opacity: 0, ease: Power2.easeInOut, onComplete: function () { $(".visual-intro-bg").removeAttr("style"); } }) } //$txtList.eq(visualIndex).addClass("active-item").find(".main-visual-txt-con").css("animation","fadeInUp 0.8s both 0.8s"); $bulletList.eq(visualIndex).addClass("active-item"); } function visualPlay(check, clickIndex) { /* Visual Active Play */ if (isClick == 0) { isClick = 1; if (check === 'bullet') { visualIndex = visualNextCheck(clickIndex, check); } else { visualIndex = visualNextCheck(visualIndex, check); } slideChangeAction(visualIndex); } } /* Bullet Click */ $bulletList.click(function () { var clickIndex = $(this).index(); if (clickIndex != visualIndex) { clearInterval(visual_timer); if (isClick == 0) { isClick = 1; resetVisual(); activeAndNextActive(clickIndex); visualIndex = clickIndex; slideChangeAction(visualIndex); visual_timer = setInterval(function () { visualPlay(); }, visualSpeed) } } }); /* Arrow And Pause/play Click */ $(".visual-pause-btn").click(function () { clearInterval(visual_timer); $(this).hide(); $(".visual-play-btn").show(); }); $(".visual-play-btn").click(function () { visual_timer = setInterval(function () { visualPlay(); }, visualSpeed) $(this).hide(); $(".visual-pause-btn").show(); }); $(".visual-next-play-btn").click(function (e) { clearInterval(visual_timer); visualPlay(); visual_timer = setInterval(function () { visualPlay(); }, visualSpeed) }); $(".visual-prev-play-btn").click(function (e) { clearInterval(visual_timer); visualPlay('prev'); visual_timer = setInterval(function () { visualPlay(); }, visualSpeed) }); // �ろ伂搿� �勳澊旖� 绎厴 if ($.exists('.scroll-icon')) { var $moveIcon = $('.scroll-icon'); var moveIcon = setInterval(function () { $moveIcon.animate({ opacity: '.5', "margin-bottom": '-=5px' }).animate({ opacity: '1', "margin-bottom": '+=5px' }) }, 1000); } /* *********************** 准旍澑 Business ************************ */ $('.main-business-list-con').slick({ slidesToShow: 3, arrows: true, fade: false, dots: false, autoplay: false, speed: 800, infinite: true, autoplaySpeed: 3000, easing: 'easeInOutQuint', centerMode: true, centerPadding: "0", pauseOnHover: false, prevArrow: '.main-buisness-prev-btn', nextArrow: '.main-buisness-next-btn', responsive: [ { breakpoint: 1025, settings: { slidesToShow: 1, slidesToScroll: 1, centerMode: false } } ] }); /* *********************** 准旍澑 Relation ************************ */ $('.relation-list-con > ul').slick({ slidesToShow: 3, slidesToScroll: 1, arrows: true, fade: false, dots: false, autoplay: false, speed: 800, infinite: true, autoplaySpeed: 3000, easing: 'easeInOutQuint', pauseOnHover: false, prevArrow: '.relation-prev-btn', nextArrow: '.relation-next-btn', responsive: [ { breakpoint: 801, settings: { slidesToShow: 2, slidesToScroll: 1 } }, { breakpoint: 481, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); }); $(window).load(function () { setTimeout(function () { $("#mainVisual").addClass("active-item"); }, 150); });