$(function(){ tl = TweenMax; tl.staggerFromTo($(".pc #wrap header .header_wrap"), 0.7, {opacity:1, x:'-100%'}, {opacity:1, x:'0%', delay:1, ease: Power1.easeOut}); tl.staggerFromTo($(".tm #wrap header .header_wrap"), 0.7, {opacity:1, y:'-100%'}, {opacity:1, y:'0%', delay:1, ease: Power1.easeOut}); //height 모바일 높이 대응 function resetHeight(){ $('.fullpage').css('height', $(window).innerHeight()); } window.addEventListener("resize", resetHeight); resetHeight(); //fullpage var $fullpage = $('.fullpage'); var main_fullpage_slider = new Swiper($fullpage, { effect: "slide", autoplay: false, slidesPerView: 'auto', speed:1100, autoHeight: true, parallax: true, mousewheel: { releaseOnEdges: true }, calculateHeight:true, allowTouchMove:false, simulateTouch:false, grabCursor: false, touchStartPreventDefault:false, mousewheelControl: true, watchSlidesProgress: true, watchSlidesVisibility: true, breakpoints: { 1279: { allowTouchMove:true, simulateTouch:true, grabCursor: true, }, }, on: { init: function () { //하단 화살표 progress var secNum = this.activeIndex +1; var fullSecNum = $('.fullpage .section').length; var dashoffset = 305; $("#scroll_wrap #circle_i circle").stop().velocity({ 'stroke-dashoffset': dashoffset-((dashoffset/fullSecNum)*secNum)}, { delay:0, duration: 800 }); }, transitionStart : function () { var secNum = this.activeIndex +1; $('.sec'+secNum).addClass('act'); $('.section').addClass('none'); ///다크모드 if($('.section.dark').hasClass('swiper-slide-active')){ $('body').addClass('dark'); }else{ $('body').removeClass('dark'); } //하단 화살표 progress var fullSecNum = $('.fullpage .section').length; var dashoffset = 305; $("#scroll_wrap #circle_i circle").stop().velocity({ 'stroke-dashoffset': dashoffset-((dashoffset/fullSecNum)*secNum)}, { delay:0, duration: 800 }); ///하단 화살표 progress 텍스트숨기기 if($('.sec1').hasClass('swiper-slide-active')){ $('#scroll_wrap button .txt').removeClass('hide'); }else{ $('#scroll_wrap button .txt').addClass('hide'); } //마지막섹션 if($(".fullpage .section:last-child").hasClass("swiper-slide-active")){ $('#scroll_wrap').addClass('prev'); }else{ $('#scroll_wrap').removeClass('prev'); } //overflow section scroll기능 if($('.section.overflow').hasClass('swiper-slide-active')){ $('.pc .fullpage .overflow .inner').niceScroll({ cursorcolor: "#fff", cursorwidth: 4, scrollspeed: 70, cursorborderradius: 10, mousescrollstep: 50, cursoropacitymin: 0, cursoropacitymax: 1, background: "rgba(0,0,0,0)", cursorborder: "none", autohidemode: false, boxzoom: false, smoothscroll: true, zindex:1001, }); $('.tm .fullpage .overflow .inner').niceScroll({ cursorcolor: "#fff", cursorwidth: 4, scrollspeed: 0, cursorborderradius: 10, mousescrollstep: 20, cursoropacitymin: 0, cursoropacitymax: 1, background: "rgba(0,0,0,0)", cursorborder: "none", autohidemode: false, boxzoom: false, smoothscroll: true, zindex:1001, }); //nicescroll 스크롤바 숨기기 $('[id*="ascrail"]').removeClass('on'); $(this).removeClass('next'); if($('.section.overflow').hasClass('next')){ $('#scroll_wrap').removeClass('down'); }else{ $('#scroll_wrap').addClass('down'); } }else{ //nicescroll 스크롤바 숨기기 $('[id*="ascrail"]').addClass('on'); $(this).addClass('next'); $('#scroll_wrap').removeClass('down'); } //overflow section scroll 끝날 시 var lastScrollTop = 0, delta = 10; $('.fullpage .section.overflow .inner').scroll(function(){ var thisElem = $(this); var moreConElem =$('.sec2 .more_contents').offset().top; $(window).resize(function(){ var thisElem = $(this); }).resize(); if ( thisElem[0].scrollHeight - thisElem.scrollTop() == thisElem.outerHeight()){ //내릴때 $('#scroll_wrap').removeClass('down'); $('#scroll_wrap').addClass('next'); $(this).parents('.section.overflow').addClass('next'); $(this).parents('.section.overflow').removeClass('down'); }else{ //끝날때 $('#scroll_wrap').removeClass('next'); $('#scroll_wrap').addClass('down'); $(this).parents('.section.overflow').removeClass('next'); $(this).parents('.section.overflow').addClass('down'); } }); }, transitionEnd: function () { $('.section').removeClass('none'); }, }, }); //scroll btn click $('#scroll_wrap .icon').on('click', function(){ if($(".fullpage .section:last-child").hasClass("swiper-slide-active")){ //첫번째 섹션으로이동 main_fullpage_slider.slideTo(0, 1000); $('.fullpage .overflow .inner').animate({scrollTop: 0}, 0); setTimeout(function() { $('#scroll_wrap').removeClass('down'); }, 1000); }else if($(".fullpage .section.overflow.down").hasClass("swiper-slide-active")){ //컨텐츠 더보기버튼 var fixConHeight = $('.fullpage .section.overflow .title_wrap').height(); var scrollPosition = $('.fullpage .section.overflow .inner').scrollTop(); var scrollPosition2 = $('.fullpage .section.overflow .inner')[0].scrollHeight; console.log(scrollPosition2); if(fixConHeight > scrollPosition){ $('.fullpage .section.overflow .inner').animate({scrollTop:fixConHeight}, 800); }else{ $('.fullpage .section.overflow .inner').animate({scrollTop:scrollPosition2}, 800); } }else if($(".fullpage .section.overflow").hasClass("next")){ //다음섹션으로 이동 main_fullpage_slider.slideNext(1000) }else{ //다음섹션으로 이동 main_fullpage_slider.slideNext(1000) } }); //////////////// 메인 슬라이더 function TextMotion() { tl.staggerFromTo($(".fullpage .sec1 .swiper-slide-active .title_layout1 .cate p"), 0.6, {opacity: 0, y: '100%'}, {opacity: 1, y: '0%',delay:0.9, ease: Power1.easeOut}); tl.staggerFromTo($(".fullpage .sec1 .swiper-slide-active .title_layout1 .title p span"), 0.7, {opacity: 0, y: '100%'}, {opacity: 1, y: '0%',delay:0.9, ease: Power1.easeOut},0.3); tl.staggerFromTo($(".fullpage .sec1 .swiper-slide-active .title_layout1 .txt1"), 0.7, {opacity: 0, y: '100%'}, {opacity: 1, y: '0%',delay:1.3, ease: Power1.easeOut}); } function TextMotionInit() { tl.staggerFromTo($(".fullpage .sec1 .swiper-slide-active .title_layout1 .cate p"), 0.7, {opacity: 1, y: '0%'}, {opacity: 0, y: '100%', delay:0.4,ease: Power1.easeOut}); tl.staggerFromTo($(".fullpage .sec1 .swiper-slide-active .title_layout1 .title p span"), 0.7, {opacity: 1, y: '0%'}, {opacity: 0, y: '100%',delay:0.4,ease: Power1.easeOut}); tl.staggerFromTo($(".fullpage .sec1 .swiper-slide-active .title_layout1 .txt1"), 0.7, {opacity: 1, y: '0%'}, {opacity: 0, y: '100%',delay:0.4,ease: Power1.easeOut}); } //main_slider var mainBgSlider = new Swiper('.sec1 .main_slider', { effect: 'fade', speed: 1000, loop:true, autoplay: { delay:6000, }, fadeEffect: { crossFade: false, disableOnInteraction: false, }, allowTouchMove:false, simulateTouch:false, grabCursor: false, thumbs: { swiper: mainTextSlider }, watchSlidesVisibility: true, on: { init: function () { tl.staggerFromTo($(".sec1 .main_slider .item1 .img_g"), 3, {scale:'1.1'}, {scale:'1', ease: Power1.easeOut}); }, transitionStart: function () { tl.staggerFromTo($(".sec1 .main_slider .item .img_g"), 2.5, {scale:'1.05'}, {scale:'1', ease: Power1.easeOut}); }, slideChange: function () { }, }, }); //main_slider var mainTextSlider = new Swiper('.sec1 .text_slider', { effect: 'fade', speed: 1000, loop:true, autoplay: { delay: 6000, disableOnInteraction: false, }, fadeEffect: { crossFade: true }, allowTouchMove:false, simulateTouch:false, grabCursor: false, thumbs: { swiper: mainBgSlider }, watchSlidesVisibility: true, pagination: { el: '.sec1 .pagination', clickable: true, renderBullet: function (index, className) { return '