var m_basic = 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){ $active.removeClass('on'); $content.hide(); $active = $(this); $content = $($(this).attr('href')); $active.addClass('on'); $content.show(); e.preventDefault(); }); }); // ¸ð´Þ ½ºÅ©¸³Æ®´Â ÇÏ´ÜÀÇ ½ºÅ©¸³Æ®·Î ±³Ã¼Çϵµ·Ï ÇÑ´Ù. ¿©ÁØÇõ. 2013-10-29ÀϺÎÅÍ ÁøÇàÁß $('a[href=#login_modal]').click(function(e){ $('#login_modal').fadeToggle(100); e.preventDefault(); }); /* windowHeight = $(window).height(); $('.modal_open').click(function(e){ // ¸ð´Þ ¿­±â °øÅë var $modal = $($(this).attr('href')); $modal.fadeIn(100); modalHeight =$('.modal').outerHeight(); modalHeadH = $('.modal').children('header').outerHeight(); if(modalHeight >= windowHeight) { $('.modal').addClass('modal_resize'); $('.modal .modal_inner').css({'top':modalHeadH}); } e.preventDefault(); }); $('.modal_close').click(function(e){ // ¸ð´Þ ´Ý±â $(this).parents('.all_wrap').fadeOut(100); $('.modal').removeClass('modal_resize'); e.preventDefault(); }); */ /* $(window).bind("resize scroll", function(){ // ±¸¸ÅÇϱ⠹öÆ° À§Ä¡ Á¶Á¤Çϱâ var tempScrollTop, currentScrollTop = 0; docuHeight = $(document).height(); // ¹®¼­ Àüü ³ôÀÌ windowHeight = $(window).height(); // â Àüü ³ôÀÌ footerH = $('#footer').outerHeight(); currentScrollTop = $(window).scrollTop(); buyHeight = $('.detail_buy').offset() if( currentScrollTop+windowHeight-footerH == docuHeight-footerH){ $('.detail_buy').css('bottom',footerH); } else { $('.detail_buy').css('bottom',0); } tempScrollTop = currentScrollTop; }); */ // 2013-10-29 ¿©ÁØÇõ, ¸ð´Þâ °øÅëÈ­ ½ºÅ©¸³Æ® $(window).bind('load, scroll', function(){ winScroll = $(this).scrollTop(); }); $('.btn_close').click(function(e){ modal_close(); e.preventDefault(); }); $('a.modal_open').click(function(e){ // a ű׿¡ Ŭ·¡½º¸¦ ÁÖ¾úÀ» ¶§ ¸ð´Þ ¿­±â e.preventDefault(); modalName = $(this).attr('href'); modal_open(modalName); }); } $(document).ready(function(){ m_basic(); }); function modal_open(modalName) { // ¸ð´Þ ¿­±â °øÅë history.pushState(null, null, location.href); modal = $(modalName); // ¸ð´Þâ ID°ªÀ¸·Î ¿­±â //modal = $(this).attr('href'); // ¸ð´Þâ ID°ªÀ¸·Î ¿­±â //modalBody = $(modal).children('.modal_wrap'); // ½ÇÁ¦ ¸ð´Þâ $(modalName+' img').each(function(){ $(this).attr('src',$(this).data('src')); }); winScroll = $(this).scrollTop(); $(modal).stop().show(); $('#m_wrap').addClass('modalFix').css('top',-winScroll); // ½ºÅ©·Ñ¹Ù ¸·°í, »çÀÌÁî °íÁ¤ $('body').addClass('winFix'); // body¿¡ ½ºÅ©·Ñ¹Ù } function modal_close() { // ¸ð´Þ ´Ý±â °øÅë //history.replaceState(null, null, ''); winTop = Math.abs(parseInt($('#m_wrap').css('top'))); // ¸ð´Þ ´ÝÀ» ½Ã ÇöÀç ½ºÅ©·Ñ À§Ä¡°ª ¹Ýȯ $('.m_modal').hide(); $('body').removeClass('winFix'); $('#m_wrap').removeClass('modalFix').css('top',''); $(window).scrollTop(winTop); winTop = 0; } function modal_open2_resize(modalName) { var s_height=$(document).scrollTop(); modal = $(modalName); modalBody = $(modal).children('.modal_wrap'); modalHeader = $(modal).find('.header'); modalInner = $(modal).find('.modal_inner'); $(modal).stop().show(0, function(){ var modalHeight=Math.abs(parseInt(modalInner.outerHeight())) + Math.abs(parseInt(modalHeader.outerHeight())); console.log(modalHeight); modalBody.css({ "height":modalHeight }); }); } //³ôÀÌ °¡º¯È­µÇ´Â ¸ð´Þ ¿­°í ´Ý±â function modal_open2_ver2(modalName) { $(modalName+' img').each(function(){ $(this).attr('src',$(this).data('src')); $(this).load(function(){ modal_open2_resize(modalName); }); }); var s_height=$(document).scrollTop(); modal = $(modalName); modalBody = $(modal).children('.modal_wrap'); modalHeader = $(modal).find('.header'); modalInner = $(modal).find('.modal_inner'); $(modal).stop().show(0, function(){ modal_open2_resize(modalName); }); $("#m_wrap").addClass("modalFix"); $("body").addClass("winFix"); $("#m_wrap").css("top",-s_height); } //³ôÀÌ °¡º¯È­µÇ´Â ¸ð´Þ ¿­°í ´Ý±â function modal_open2(modalName) { $(modalName+' img').each(function(){ $(this).attr('src',$(this).data('src')); }); var s_height=$(document).scrollTop(); modal = $(modalName); modalBody = $(modal).children('.modal_wrap'); modalHeader = $(modal).find('.header'); modalInner = $(modal).find('.modal_inner'); $(modal).stop().show(); var modalHeight=Math.abs(parseInt(modalInner.outerHeight())) + Math.abs(parseInt(modalHeader.outerHeight())); console.log(modalHeight); modalBody.css({ "height":modalHeight }); $("#m_wrap").addClass("modalFix"); $("body").addClass("winFix"); $("#m_wrap").css("top",-s_height); } function modal_close2(modalName) { winTop = Math.abs(parseInt($('#m_wrap').css('top'))); modal = $(modalName); $('.m_modal').hide(); $("#m_wrap").removeClass("modalFix").css("top"); $("body").removeClass("winFix"); $(window).scrollTop(winTop); winTop = 0; } $(".m_modal .btn_close2, .m_modal .btn_ok2, .m_modal .btn_cancel2").click(function() { var modal=$(this).parents(".m_modal").attr("id"); modal_close2("#"+modal); }); //¸ð´ÞÀ§¿¡ ¸ð´Þ ¶ç¾úÀ» ¶§ ´Ý±â $(".m_modal .btn_close3, .m_modal .btn_ok3, .m_modal .btn_cancel3").click(function() { var modal=$(this).parents(".m_modal").attr("id"); $(this).parents(".m_modal").hide(); }); //-- on À̺¥Æ® µî·Ï /* $(¼¿·ºÅÍ).on("show", function(){ console.log("menu on"); }); $(¼¿·ºÅÍ).on("hide", function(){ console.log("menu off"); }); */ //show ,hide °¨Áö±â´É (function ($) { $.each(['show', 'hide'], function (i, ev) { var el = $.fn[ev]; $.fn[ev] = function () { this.trigger(ev); return el.apply(this, arguments); }; }); })(jQuery);