$(document).ready(function(){ m31(); m64(); /* scroll */ var $animation_elements = $('.ani'); 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'); $(window).scroll(function(){ if($(this).scrollTop() >= 10){ $("header").addClass("wht"); $("header .gnb").mouseleave(function(){ $("header").addClass("wht"); }); }else{ $("header").removeClass("wht"); $("header .gnb").mouseleave(function(){ $("header").removeClass("wht"); }); } }); }); function m31(){ if(!$("#main").hasClass("m31")) return; //swiper 여러개 사용할때 $(".m31 .section").each(function(index, element){ var $this = $(this); var techswiper = new Swiper('.tech_slider0' + index, { slidesPerView : 'auto', navigation: { nextEl: $('.tech_slider0' + index).siblings('.tech_next'), prevEl: $('.tech_slider0' + index).siblings('.tech_prev'), }, }); var viewSwiper = new Swiper('.view_slider0' + index, { spaceBetween: 10, allowTouchMove:false, navigation: { nextEl: '.tech_next0'+ index, prevEl: '.tech_prev0'+ index, }, thumbs: { swiper: techswiper, }, }); }); } function m64(){ if(!$("#main").hasClass("m64")) return; $(".q_wrap .btn").on("click",function(){ $(this).parent().toggleClass("act"); $(this).parents("li").toggleClass("on"); $(this).parent().next().slideToggle(300); $(this).parents().siblings("li").removeClass("on"); $(this).parents().siblings("li").find(".q_wrap").removeClass("act"); $(this).parents().siblings("li").find(".q_wrap").next("div").slideUp(); }); }