$(function() { // Ãßõ»óÇ° ÅÇ Å¬¸¯ $(".section2 ul.product_tab li").click(function() { var winWidth = $(window).width(); var tabIndex = $(this).index(); var linkTitle = $(this).find('a').text(); if(winWidth <= 1024) { $(".section2 ul.product_tab").css('display','none'); $(".section2 .dropdown > a").removeClass('open'); } $(".section2 .dropdown > a").text(linkTitle); $(".section2 ul.product_tab li").removeClass('on'); $(this).addClass('on'); $(".section2 .tab_wrap .tab_con").css('display','none'); $(".section2 .tab_wrap .tab_con").eq(tabIndex).stop(true,false).fadeIn(300); }); // Ãßõ»óÇ° µå·Ó´Ù¿î ¸µÅ© $(".section2 .dropdown > a").click(function() { if(!$(this).hasClass('open')) { $(this).addClass('open'); $(this).siblings('ul.product_tab').css('display','block'); } else { $(this).removeClass('open'); $(this).siblings('ul.product_tab').css('display','none'); } }); // Ãßõ»óÇ° µå·Ó¹Ú½º È°¼ºÈ­ function initProDrop() { var linkTitle = $(".section2 ul.product_tab li.on a").text(); $(".section2 .dropdown > a").text(linkTitle); } $(window).load(function() { initProDrop(); }); }); // ¸ÞÀÎ ·Ñ¸µ À̹ÌÁö // interval timer function intervalTimer(callback, interval) { var timerId, startTime, remaining = 0; var state = 0; // 0 = idle, 1 = running, 2 = paused, 3= resumed this.pause = function () { if (state != 1) return; remaining = interval - (new Date() - startTime); window.clearInterval(timerId); state = 2; }; this.resume = function () { if (state != 2) return; state = 3; window.setTimeout(this.timeoutCallback, remaining); }; this.timeoutCallback = function () { if (state != 3) return; callback(); startTime = new Date(); timerId = window.setInterval(callback, interval); state = 1; }; startTime = new Date(); timerId = window.setInterval(callback, interval); state = 1; } // ¸ÞÀÎ ·Ñ¸µ¹è³Ê À̹ÌÁö (¼½¼Ç1) $(function() { var slide_index = 0; var slide_size; var sliderWrap = $("#imgSlider"); var slider = sliderWrap.find('.imgList'); var slide_count = slider.children().length; var slide_timer; var slide_term; var slide_timer_first = true; var easeEffect = "easeInOutQuart"; // ·Ñ¸µ Áֱ⠼³Á¤ if(!sliderWrap.data('interval')) { slide_term = 6000; } else { slide_term = sliderWrap.data('interval'); } // Ãʱ⠼¼Æà function setting() { var paging = ""; slide_size = slider.children().width(); slider.children().css({left:-slide_size}); slider.children().eq(slide_index).css({left:0}); slider.children().eq(slide_index+1).css({left:slide_size}); paging += ''; paging += '
    '; for(i=0; i li:first').addClass('on'); } // ½½¶óÀ̵å ÇÔ¼ö function slide(direction) { var before_index; if(!direction || direction === 'next') { slide_size = slider.children().width(); if(slide_index >= slide_count) { slide_index = 0; before_index = slide_count - 1; } else { before_index = slide_index - 1; } } else { slide_size = -(slider.children().width()); if(slide_index < 0) { slide_index = slide_count - 1; before_index = 0; } else { before_index = slide_index + 1; } } sliderWrap.find('.pagination > li').removeClass('on'); sliderWrap.find('.pagination > li .bar').css({width:0}); sliderWrap.find('.pagination > li:eq(' + slide_index + ')').addClass('on'); sliderWrap.find('li').removeClass('active'); sliderWrap.find('li:eq(' + slide_index + ')').addClass('active'); slider.children().eq(slide_index).css({left:slide_size}); slider.children().eq(slide_index).animate({left:0}, 500, easeEffect); slider.children().eq(before_index).css({left:0}); slider.children().eq(before_index).animate({left:-slide_size}, 500, easeEffect); } // ÀÚµ¿ ½½¶óÀ̵å function autoslide() { sliderWrap.find('.pagination > li:eq(' + slide_index + ') > .bar').animate({width:'100%'}, slide_term - 100, function() { slide_index++; slide('next'); }); } // ŸÀÌ¸Ó ½ÃÀÛ function startTimer() { slide_timer = new intervalTimer(function() { autoslide(); }, slide_term); } // ŸÀÌ¸Ó º¹±Í function resumeTimer() { slide_timer.resume(); } // ŸÀÌ¸Ó ÀϽÃÁ¤Áö function pauseTimer() { slider.children().stop(); sliderWrap.find('.pagination > li > .bar').stop(); slide_timer.pause(); } // ŸÀÌ¸Ó ÃʱâÈ­ function clearTimer() { slider.children().stop(); sliderWrap.find('.pagination > li > .bar').stop(); slide_timer.timeoutCallback(); } // ÀÌÀü ¹öÆ° sliderWrap.find('.prev').click(function() { if(!slider.children().is(':animated')) { clearTimer(); slide_index--; slide('prev'); resumeTimer(); } }); // ´ÙÀ½ ¹öÆ° sliderWrap.find('.next').click(function() { if(!slider.children().is(':animated')) { clearTimer(); slide_index++; slide('next'); resumeTimer(); } }); // ¸¶¿ì½º ¿À¹ö½Ã ŸÀÌ¸Ó ÀϽÃÁ¤Áö slider.mouseenter(function() { if(!slider.children().is(':animated')) { pauseTimer(); } }); // ¸¶¿ì½º ¿À¹ö ÇØÁ¦½Ã ŸÀÌ¸Ó º¹±Í slider.mouseleave(function() { if(!slider.children().is(':animated')) { resumeTimer(); } }); setting(); autoslide(); startTimer(); });