$(function(){ Splitting(); /* 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 menu = ['1/5', '2/5', '3/5' , '4/5', '5/5'] var Mainswiper = new Swiper('.main_slide', { speed: 800, slidesPerView: 'auto', mousewheel: { releaseOnEdges: true, }, pagination: { el: '.swiper-pagination', clickable: true, renderBullet: function (index, className) { return '' + (menu[index]) + ''; }, }, disableOnInteraction: true, watchSlidesVisibility: true, allowTouchMove: false, on: { init: function(){ }, slideChange: function(){ if(this.activeIndex == 4){ $("body").addClass("black"); }else{ $("body").removeClass("black"); } if(this.activeIndex == 5){ $(".main_slide .swiper-pagination").addClass("hide"); }else{ $(".main_slide .swiper-pagination").removeClass("hide"); } }, slideChangeTransitionStart: function(){ if($(".section03").hasClass("swiper-slide-active")){ $(".section03").addClass("on"); } }, }, breakpoints: { 1279: { direction:'vertical', freeMode: true, allowTouchMove: true, }, }, }); Mainswiper.on('transitionStart', function() { if($('.main_slide .footer').hasClass('swiper-slide-visible')){ $('body').addClass("end"); }else{ $("body").removeClass("end"); } }) $(".move").click(function(){ Mainswiper.slideTo(0); }); var swiper2 = new Swiper('.indi_slide', { effect: 'coverflow', speed:500, grabCursor: false, allowTouchMove: false, centeredSlides: true, slidesPerView: 'auto', coverflowEffect: { rotate:40, stretch:0, depth:100, modifier:1, slideShadows:0, }, navigation: { nextEl: ".indi_next", prevEl: ".indi_prev", }, loop: true, breakpoints: { 1279: { allowTouchMove: true, grabCursor: true, }, }, }); var swiper3 = new Swiper('.news_wrap', { slidesPerView: 'auto', spaceBetween: 15, navigation: { nextEl: ".news_next", prevEl: ".news_prev", }, }); var swiper4 = new Swiper('.notice_wrap', { slidesPerView: 'auto', spaceBetween: 15, navigation: { nextEl: ".notice_next", prevEl: ".notice_prev", }, }); }); $(document).ready(function(){ $(".main_slide").addClass("on"); //transition 끝난 후 실행 $('.main_slide .section02 .text .tit').one('transitionend MSTransitionEnd webkitTransitionEnd oTransitionEnd', function(event) { $('.section02').addClass('on'); }); $(".main_slide .section03 .swiper-slide .img_wrap img").bind('transitionend MSTransitionEnd webkitTransitionEnd oTransitionEnd', function(event) { $('.section03').removeClass('on'); }); });