$(function(){ $(window).scroll(function(){ scroll = $(window).scrollTop(); if(scroll > 0){ $("#header").addClass("wh"); }else{ $("#header").removeClass("wh"); } }) $('.lnb a').click(function(){ _top = $($(this).attr('href')).offset().top; $('html, body').stop().animate({scrollTop: _top },400); return false }); lnbT = $(".lnb").offset().top; secT = $(".sec_id").length; for(i=0;i lnbT){ $(".lnb").css("position","fixed") }else{ $(".lnb").css("position","absolute") } for(j=0;j= $("#section"+(j+1)+"").offset().top - (headerH*2)){ $(".lnb li").removeClass(); $(".lnb li:eq("+j+")").addClass("on"); }; } }) var Swiper1 = new Swiper('.product', { slidesPerView: '1', direction: 'horizontal', speed: 800, loop: true, autoHeight: true, /* autoplay: { delay: 5000, disableOnInteraction: true, },*/ pagination: { el: '.swiper-pagination', clickable: true, }, keyboard: { enabled: true, onlyInViewport: false, }, navigation: { nextEl: '.pnext', prevEl: '.pprev', }, }); $(window).on('load', function(){ Swiper1.slideTo(slideNum, 1000); }); $(document).on(".target","click",function(){ Swiper1.slideTo(slideNum, 0); }) 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 + (element_height ); var element_bottom_position = (element_top_position + element_height); //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'); })