// m11 스크롤 페이지 스크롤 이벤트 var onePage = jQuery(function($){ var onePage = {} var hash = window.location.hash; if(hash == 1 ){ var targetPos = $(hash).offset().top; var head_h = $('#header').height(); var subtab_h = $('.m1_tabs').height(); $('html, body').stop().animate({scrollTop : targetPos-subtab_h+25}, 800); } $('.sub_nav li a').each(function(){ $(this).on('click', function(e, $this){ // m11 서브 탭 페이지 이동시 스크롤 이벤트 //$(this).parents('li').addClass('on').siblings().removeClass('on'); var targetURL = $(this).attr('href'); var anchorArray = targetURL.split('#'); var targetAncher = $( '#' + anchorArray[1] ); var targetOffset = $(targetAncher).offset(); var targetPos = targetOffset.top; var subtab_h = $('#header').height(); if( targetURL.indexOf('#') != 0 ){ e.preventDefault(); $('html, body').stop().animate({scrollTop : targetPos-subtab_h-61}, 800, 'easeInOutQuint', function(){ var targetOffset = $(targetAncher).offset(); var targetPos = targetOffset.top; var subtab_h = $('#header').height(); $(this).addClass('on').siblings().removeClass('on'); $('html, body').stop().animate({scrollTop:targetPos-subtab_h-61} ,800); }); } }); }); $(window).scroll(function () { var w_h = $(window).scrollTop() var head_h = $('#header').height(); var subtop_h2 = $('.sub_top').height(); if( w_h < 450 ) { $('.sub_nav ').removeClass('fixed'); }else{ $('.sub_nav ').addClass('fixed'); }; var winScroll = $(this).scrollTop(); var stopPoint = []; var count; var subtab_h = $('#header').height(); $('.scroll_page>div').each(function () { stopPoint.push(parseInt($(this).offset().top)); }); for (count = 0; count < $('.scroll_page>div').length; count++){ if (winScroll >= stopPoint[count]-subtab_h-61){ $('.sub_nav li.depth2').eq(count).addClass('on').siblings().removeClass('on'); } } }); $('body').on('mousewheel', function() { $('html, body').stop() }) return onePage; }) // m11 스크롤 페이지 스크롤 이벤트 jQuery(function($){ onePageAnchor = function(){ var targetURL = window.location.href; var targetAncher = window.location.hash; var subtab_h = $('#header').height(); //alert(targetAncher) if( targetAncher ){ var targetOffset = $(targetAncher).offset(); var targetPos = targetOffset.top; $('html, body').stop().animate({scrollTop : targetPos-subtab_h-61}, 800, 'easeInOutQuint', function(){ var targetOffset = $(targetAncher).offset(); var targetPos = targetOffset.top; var subtab_h = $('#header').height(); $('html, body').stop().animate({scrollTop:targetPos-subtab_h-61} ,800) }); } }; onePageAnchor(); });