$(function(){ // ÅÇ ¸Þ´º °øÅë $('ul.tabs').each(function(){ var $active, $content, $links = $(this).find('a'); $active = $links.first().addClass('on'); $content = $($active.attr('href')); $links.not(':first').each(function () { $($(this).attr('href')).hide(); }); $(this).on('click', 'a', function(e){ if($(this).attr('href')=='#write_reply' && document.cookie.indexOf("user[id]")<1){ alert('·Î±×ÀÎ ÈÄ ÀÌ¿ëÇØÁÖ¼¼¿ä.'); location.href = '/login/'; return false; } $active.removeClass('on'); $content.hide(); $active = $(this); $content = $($(this).attr('href')); $active.addClass('on'); $content.show(); e.preventDefault(); }); }); // °Ë»ö ¿µ¿ª $('a[href=#search_box]').click(function(){ $('#search_box .typ2').toggle(); $('#search_box input[type=search]').focus(); }); // º£½ºÆ® ÄÁÅÙÃ÷ ¿­±â $('.best_more_show').click(function(){ $('.bect_li_show').removeClass('hide').addClass('show'); $(this).addClass('hide'); $('.bect_li').removeClass('show').addClass('hide') $('.best_more_hide').removeClass('hide').addClass('show') }); // º£½ºÆ® ÄÁÅÙÃ÷ ´Ý±â $('.best_more_hide, .bect_cls').click(function(){ $('.bect_li_show').removeClass('show').addClass('hide'); $('.best_more_hide').addClass('hide'); $('.bect_li').removeClass('hide').addClass('show') $('.best_more_show').removeClass('hide').addClass('show') }); // ¸ð´Þâ $('#modal_poll .btn_modal_close').click(function(){ // ¸ð´Þ ´Ý±â close_poll(this); }); // 2013-10-29 ¿©ÁØÇõ, ¸ð´Þâ °øÅëÈ­ ½ºÅ©¸³Æ® $(window).bind('load, scroll', function(){ winScroll = $(this).scrollTop(); }); $('.m_modal .btn_modal_close').click(function(e){ modal_close(); e.preventDefault(); }); $('.modal_open').click(function(e){ // ¸ð´Þ ¿­±â °øÅë if($(this).attr('href')=='#modal_poll') $("body").prepend('
'); var $modal = $($(this).attr('href')); $modal.fadeIn(100); e.preventDefault(); }); $(document).on("click", ".upload_imgs button", function(){ var img = $(this).parent().find("img").attr("src"), last = img.lastIndexOf('/'), src = img.substr(last+1); fm.files.value = fm.files.value.replace(':::'+src+':::', ':::').replace(':::'+src, '').replace(src+':::', '').replace(src, ''); $(this).parent().parent().remove(); }); }); $(window).load(function(){ $('.flexslider').flexslider({ animation: "slide", slideshow: false }); }); function close_poll(obj) { if($("body").find(".background_black")) $(".background_black").remove(); $(obj).parents('.modal').fadeOut(100); } /* ¸ð´Þ */ $(window).bind('load scroll resize',function(){ winScroll = $(this).scrollTop(); }); function modal_open(modalName) { // ¸ð´Þ ¿­±â °øÅë history.pushState(null, null, location.href); modal = $(modalName); // ¸ð´Þâ ID°ªÀ¸·Î ¿­±â //modal = $(this).attr('href'); // ¸ð´Þâ ID°ªÀ¸·Î ¿­±â //modalBody = $(modal).children('.modal_wrap'); // ½ÇÁ¦ ¸ð´Þâ winScroll = $(this).scrollTop(); $(modal).stop().show(); $('body').addClass('modalFix').css('top',-winScroll); // ½ºÅ©·Ñ¹Ù ¸·°í, »çÀÌÁî °íÁ¤ $('body').addClass('winFix'); // body¿¡ ½ºÅ©·Ñ¹Ù } function modal_close() { // ¸ð´Þ ´Ý±â °øÅë //history.replaceState(null, null, ''); winTop = Math.abs(parseInt($('body').css('top'))); // ¸ð´Þ ´ÝÀ» ½Ã ÇöÀç ½ºÅ©·Ñ À§Ä¡°ª ¹Ýȯ modal.hide(); $('body').removeClass('winFix'); $('body').removeClass('modalFix').css('top',''); $(window).scrollTop(winTop); winTop = 0; } //³ôÀÌ °¡º¯È­µÇ´Â ¸ð´Þ ¿­°í ´Ý±â function modal_open2(modalName) { var s_height=$(document).scrollTop(); modal = $(modalName); modalBody = $(modal).children('.modal_wrap'); $(modal).stop().show(); var height=modalBody.outerHeight(); var w_height=$(window).height(); var margin=(w_height-height)/2; //var marginL=modalBody.width()/2; modalBody.css({ "margin-top":margin, //"margin-left":-marginL, }); $("body").addClass("modalFix"); $("body").addClass("winFix"); $("body").css("top",-s_height); } function modal_close2(modalName) { winTop = Math.abs(parseInt($('body').css('top'))); modal = $(modalName); $('.m_modal').hide(); $("body").removeClass("modalFix").css("top"); $("body").removeClass("winFix"); $(window).scrollTop(winTop); winTop = 0; } $(".m_modal .btn_modal_close2, .m_modal .btn_ok2, .m_modal .btn_cancel2").click(function() { var modal=$(this).parents(".m_modal").attr("id"); modal_close2("#"+modal); });