$(function(){ //height 모바일 높이 대응 function resetHeight(){ $('.full_slider').css('height', $(window).innerHeight()); } window.addEventListener("resize", resetHeight); resetHeight(); /* scroll */ var $animation_elements = $('.animation-element'); var $window = $(window); function check_if_in_view() { var window_height = $window.height(); var window_top_position = $window.scrollTop(); var window_bottom_position = (window_top_position + window_height); $.each($animation_elements, function() { var $element = $(this); var element_height = $element.outerHeight(); var element_top_position = $element.offset().top+200; var element_bottom_position = (element_top_position + element_height); //console.log(element_top_position); //check to see if this current container is within viewport if ((element_bottom_position >= window_top_position) && (element_top_position <= window_bottom_position)) { $element.addClass('in-view'); } else { //$element.removeClass('in-view'); } }); } $window.on('scroll resize', check_if_in_view); $window.trigger('scroll'); // 레이어팝업 var bg = $("#bg"); $(document).on('click',' #bg, .close ', function () { bg.fadeOut(); $('#video-popup div.inner').html(''); $('#video-popup').hide(); }); $('.play_btn').on('click', function(){ var dataUrl = $(this).attr('data-url'); if(dataUrl){ bg.show(); $('#video-popup').show(); $('#video-popup').html( ''+ '
'+ '
' ); $('#video-popup div.inner').html(dataUrl); }else { alert('준비중 입니다.'); } }); var fullSwiper = new Swiper('.full_slider', { slidesPerView:'auto', direction: "vertical", effect: "slide", autoplay: false, speed: 800, //parallax: true, pagination: { el: ".full_pagination", clickable: true, }, allowTouchMove:false, simulateTouch:false, grabCursor: false, touchStartPreventDefault:false, watchSlidesProgress: true, watchSlidesVisibility: true, mousewheel: { releaseOnEdges: true }, mousewheelControl: true, on: { init: function(){ $(".section1").addClass("on"); if(this.activeIndex == 0){ $(".scroll_btn").click(function(){ fullSwiper.slideTo(1,800); }); }else { $(".scroll_btn").click(function(){ fullSwiper.slideTo(0,800); }); } }, transitionStart: function(){ let idx = this.activeIndex; if(this.activeIndex == 0){ $(".scroll_btn").removeClass("top").addClass("down"); $(".scroll_btn p").removeClass("on"); $(".scroll_btn p.down").addClass("on"); $(".scroll_btn").click(function(){ fullSwiper.slideTo(1,800); }); }else { $(".scroll_btn").removeClass("down").addClass("top"); $(".scroll_btn p").removeClass("on"); $(".scroll_btn p.top").addClass("on"); $(".scroll_btn").click(function(){ fullSwiper.slideTo(0,800); }); } if($(".section:eq("+idx+")").hasClass("swiper-slide-active")){ $(".section:eq("+idx+")").addClass("on"); } if($(".section:eq("+idx+")").hasClass("bk")){ $("body").addClass("bk"); }else { $("body").removeClass("bk"); } var footerHgt = $("#footer").height(); if($(".footer_section").hasClass("swiper-slide-visible")){ $("body").addClass("end"); if($(window).width() >= 1280){ $(".scroll_btn").css("bottom",footerHgt + 50); }else { $(".scroll_btn").css("bottom",footerHgt + 20); } $(".full_slider .full_pagination").css("margin-top",-footerHgt); }else { $("body").removeClass("end"); if($(window).width() >= 1280){ $(".scroll_btn").css("bottom",50); }else { $(".scroll_btn").css("bottom",20); } $(".full_slider .full_pagination").css("margin-top",0); } }, }, breakpoints: { 1279: { allowTouchMove:true, simulateTouch:true, grabCursor: true, touchStartPreventDefault:true, } }, }); var mainSwiper = new Swiper(".main_slider", { speed: 600, effect: "fade", //parallax: true, pagination: { el: ".main_pagination", clickable: true, }, navigation: { nextEl: ".main_next", prevEl: ".main_prev", }, }); var newsSwiper = new Swiper(".news_slider", { speed: 600, slidesPerView:'auto', spaceBetween: 40, loop:true, observer: true, // 추가 observeParents: true, navigation: { nextEl: ".news_next", prevEl: ".news_prev", }, breakpoints: { 768: { spaceBetween: 20, }, 1024: { spaceBetween: 40, }, }, }); });