/***************************************************** * ¾÷µ¥ÀÌÆ® ±ÝÁö ******************************************************/ $(function(){ //thumbnail $('.gallery li a .thumb>img, .pdt_box .img>img').each(function(){ var thumb_wid = $(this).width(); var thumb_ht = $(this).height(); $(this).css({'margin-top':-thumb_ht/2, 'margin-left': -thumb_wid/2}); }); $(window).scroll(function() { // active or not if($(window).scrollTop()>0) { $('#header').addClass('active'); } else { $('#header').removeClass('active'); } // left positioning $('#header').find('.center').css('left',-$(this).scrollLeft()); }); //tab $('.tab_container').each(function() { if(!$(this).has('.show').length) { $(this).find('.tab_content:first').addClass('show'); } }); $('.tabs li').click(function () { $('ul.tabs li').removeClass('active'); $(this).addClass('active'); $('.tab_content').removeClass('show'); var activeTab = $(this).children('a').attr('rel'); $('#'+activeTab).addClass('show'); }); $('.pop_open').on('click', function(e){ e.preventDefault(); var popup = $(this).attr('href'); /*=============Á¦Ç° ºñ±³º¸±â Ãß°¡1 ST============*/ if (popup=="#product"){ var dr = ptdfIDX(); if(!dr){return;} } /*=============Á¦Ç° ºñ±³º¸±â Ãß°¡1 ED============*/ var pw = $(popup).width(); var ph = $(popup).height(); var tx = ($(window).width()- $(popup).width())/2; var ty = ($(window).height()-$(popup).height())/2; var sc_top = $('html, body').scrollTop() if($('.popup').is('.open')){ $('.popup').removeClass('open'); }else{ $(popup).addClass('open'); if ($(window).width() < pw ){ $('.popup').addClass('pos_ab'); $(popup).css({'margin-left':-pw/2+'px', top: sc_top + ty+'px'}); }else if ( $(window).height() < ph ){ $('.popup').addClass('pos_ab'); $(popup).css({'margin-left':-pw/2+'px', top: sc_top }); }else{ $(popup).css({left:tx+'px', top: ty+'px'}); } if ( $(window).width() < pw && $(window).height() < ph ){ $('.popup').addClass('pos_ab'); $(popup).css({'margin-left':-pw/2+'px', top: sc_top }); } } /*=============Á¦Ç° ºñ±³º¸±â Ãß°¡2 ST============*/ if (popup=="#product"){ ajax_product(); } /*=============Á¦Ç° ºñ±³º¸±â Ãß°¡2 ED============*/ }); $('.popup .btn_close').click(function(){ $('.popup').removeClass('open'); }); //btn_top $('.btn_top').click(function(){ $('html, body').animate({scrollTop : 0}, 400); return false; }); $('.quick .search, #search_box .btn_close').click(function(){ if($('#search_box').is('.active')){ $('#search_box').removeClass('active'); }else{ $('#search_box').addClass('active'); } }); }); //popup Login function popupEvent(e){ var popup = e ; var pw = $(popup).width(); var ph = $(popup).height(); var tx = ($(window).width()- $(popup).width())/2; var ty = ($(window).height()-$(popup).height())/2; var sc_top = $('html, body').scrollTop() if($(popup).is('.open')){ $(popup).removeClass('open'); }else{ $(popup).addClass('open'); if ($(window).width() < pw ){ $('.popup').addClass('pos_ab'); $(popup).css({'margin-left':-pw/2+'px', top: sc_top + ty+'px'}); }else if ( $(window).height() < ph ){ $('.popup').addClass('pos_ab'); $(popup).css({'margin-left':-pw/2+'px', top: sc_top }); }else{ $(popup).css({left:tx+'px', top: ty+'px'}); } if ( $(window).width() < pw && $(window).height() < ph ){ $('.popup').addClass('pos_ab'); $(popup).css({'margin-left':-pw/2+'px', top: sc_top }); } } } /* $(document).on("click", ".quick .search, #search_box .btn_close", function() { if($('#search_box').is('.active')){ $('#search_box').removeClass('active'); }else{ $('#search_box').addClass('active'); } });*/