$(function(){ visual1 = function(){ //line1=$("#visual .bg .inner .line1").animate({"width":"100%"},1400); //line2=$("#visual .bg .inner .line2").delay(1400).animate({"height":"90%"},1400); //line3=$("#visual .bg .inner .line3").delay(2800).animate({"width":"74%"},1400); } visual1(); $(window).scroll(function(){ scroll = $(window).scrollTop(); if(scroll > 0){ $("#header").addClass("wh"); }else{ $("#header").removeClass("wh"); } }); swiper1 = new Swiper('.inside', { spaceBetween: 20, slidesPerView: "auto", speed: 1500, loop: false, observer: true, // 추가 observeParents: true, // 추가 scrollbar: { el: '.inside .swiper-scrollbar', hide: false, draggable: true, }, draggable:false, on: { activeIndexChange: function () { //$(".swiper-slide").eq(this.realIndex + 1).addClass("on").siblings().removeClass("on"); } }, }); swiper2 = new Swiper('.news', { spaceBetween: 20, slidesPerView: "auto", speed: 1500, loop: false, observer: true, // 추가 observeParents: true, // 추가 scrollbar: { el: '.news .swiper-scrollbar', hide: false, draggable: true, }, draggable:false, on: { activeIndexChange: function () { //$(".swiper-slide").eq(this.realIndex + 1).addClass("on").siblings().removeClass("on"); } }, }); // 서브 탭 터치 var x,y,top,left,down; $(".sec6 .innerwrap .conwrap").mousedown(function(e){ e.preventDefault(); down = true; x = e.pageX; left = $(this).scrollLeft(); }); $("body").mousemove(function(e){ if(down){ var newX = e.pageX; $(".sec6 .innerwrap .conwrap").scrollLeft(left - newX + x); } }); $("body").mouseup(function(e){down = false;}); // 서브 탭 스크롤 var pageList = ".sec6 .innerwrap .conwrap"; var pageListFadeEl = ".scroll_fade"; var pageListItem = ".sec6 .innerwrap .conwrap dl"; $(pageList).on("scroll", function() { console.log($(this)[0].offsetWidth); var scrollLeft = $(this).scrollLeft(); var pageListWidth = $(this)[0].scrollWidth - $(this)[0].offsetWidth; if(scrollLeft === pageListWidth){ $(this).siblings(pageListFadeEl).addClass('is-hide'); //alert("aa") } else { $(this).siblings(pageListFadeEl).removeClass('is-hide'); } }); if($(pageListItem).hasClass("on") === true){ var activeWidth = $(".sub_tab ul li.on").width(); var activeOffset = $(".sub_tab ul li.on").offset().left; $(pageList).animate({ scrollLeft: activeOffset - activeWidth }, 300); } });