$(document).ready(function(){ $.xparam = function(name){ var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results==null){ return null; } else{ return decodeURI(results[1]) || 0; } } var tmenu = $.xparam('m') - 1, smenu = $.xparam('s') - 1; if(tmenu !== -1 && smenu !== -1) { $(".lnb > li:eq(" + tmenu + ")").addClass('active'); $(".lnb > li.active .snb li:eq(" + smenu + ")").addClass('on'); var on_sub = $('.lnb > li.active > ul.snb').html(); if(matchMedia("screen and (min-width:768px)").matches) { $('#container.sub').prepend('
') }else if(matchMedia("screen and (max-width:767px)").matches) { $('.lnbbox .lnb').after('
') }; var bbstit = $(".lnb > li.active .snb li:eq(" + smenu + ")").text(); if ($("#container.sub .bbsbox").length) { $('#container.sub .bbsbox').before('
'+bbstit+'
') }; if (tmenu == '6' && smenu == '1'){ $('#footer .f_q').remove(); $('#footer').css('padding-bottom','0'); }; console.log(tmenu+"///////"+smenu); }; $("#topgo").click(function(){ $("html, body").animate({ scrollTop: '0px' },500); return false; }); if(matchMedia("screen and (min-width:768px)").matches) { lnb(); }else if(matchMedia("screen and (max-width:767px)").matches) { m_top() deps() m_gallery(); }; //게시판정렬 function m_gallery(){ $('.bbsbox.nobg table.board > tbody > tr').each(function() { //white-header is the class used for var tr = $(this); var td1 = tr.find('> td:eq(0)').html(); var td2 = tr.find('> td:eq(1)').html(); tr.find('> td').attr('width','50%'); }); //언론보도,매장찾기 $('.webzine_type2 > tbody > tr:even').each(function() { var tr = $(this); var td1 = tr.find('> td:eq(0)').html(); tr.before(''+td1+''); tr.find('> td:eq(0)').remove(); }); } //상단메뉴 function lnb(){ var gnbwrap = $('.lnbbox'), gnb = $('.lnb > li'), depth2 = $('.lnbbox') gnb.bind({ mouseenter: function() { var _this = $(this) _this.addClass('on') depth2.stop().animate({ height:280 }, 300); depth2.addClass('on'); if ($(this).hasClass("active")) return; $('> a', this).find('i').stop(true).animate({ left: "0", width: "100%" }, 300); } }), gnb.bind({ mouseleave: function() { var _this = $(this) _this.removeClass('on') depth2.stop().animate({ height:280 }, 300); depth2.addClass('on'); if ($(this).hasClass("active")) return; $('> a', this).find('i').stop(true).animate({ left: "50%", width: "0" }, 300); } }), gnbwrap.bind({ mouseleave: function() { var _this = $(this) depth2.stop().animate({ height: 90 }, 300); depth2.removeClass('on'); } }); } function deps(){ var ht = $('#header').height(); $('#container.sub').css('margin-top',ht); } function m_top(){ var didScroll; var lastScrollTop = 0; var delta = 5; var navbarHeight = $('#header').outerHeight(); $(window).scroll(function(event){ didScroll = true; }); setInterval(function() { if (didScroll) { hasScrolled(); didScroll = false; } }, 250); function hasScrolled() { var st = $(this).scrollTop(); // Make sure they scroll more than delta if(Math.abs(lastScrollTop - st) <= delta) return; // If they scrolled down and are past the navbar, add class .nav-up. // This is necessary so you never see what is "behind" the navbar. if (st > lastScrollTop && st > 50 ){ // Scroll Down $('#header').addClass('show'); } else { // Scroll Up if(st + $(window).height() < $(document).height()) { $('#header').removeClass('show') } } lastScrollTop = st; } }; });