/** * Title : Vertical Accordion * Author : Won Joso (http://blog.naver.com/josoblue , http://www.motionj.com) * Email : joso@motionj.com * URL : http://www.motionj.com * Version : v1.0 * License : Free (»ç¿ë¹üÀ§´Â Á¦ÇÑÀÌ ¾øÀ¸³ª, Plugin(js)ÁÖ¼®À» Á¦°ÅÇÏ°í³ª ÀçÆǸſëÀ¸·Î ÀÌ¿ëµÇ¼­´Â ¾ÊµË´Ï´Ù.) * Description : * * i_width : À̹ÌÁö ÇÑ°³ÀÇ ³Êºñ * width : ·¹ÀÌ¾î ³Êºñ * height : ·¹ÀÌ¾î ³ôÀÌ * speed : ¾Ö´Ï¸ÞÀÌ¼Ç ¼Óµµ * delay : ¾Ö´Ï¸ÞÀÌ¼Ç µô·¹ÀÌ ½Ã°£ * start : ½ÃÀÛ ½Ã on ÀÌ Àû¿ëµÉ »óÀÚ(ÃÖÃÊ·Î º¸¿©Áü, 0ºÎÅÍ ½ÃÀÛ) **/ (function($){ $.fn.motionj_accordion_ad = function(o){ o = $.extend({ i_width : 360, width : 340, height : 600, speed : 500, delay : 2000, start : 0 }, o || {}); return this.each(function(){ var e = $(this); var len = e.find('ul li').length-1; if(o.start > len) o.start = 0; var no = o.start; var h_width = (o.width - o.i_width) / len; var pause = false; var ani = function(num){ for(i = 1; i <= len; i++){ if(i > num) e.find('ul li:eq('+i+')').animate({'left' : h_width*(i-1)+o.i_width}, o.speed, 'linear'); else e.find('ul li:eq('+i+')').animate({'left' : h_width*i}, o.speed, 'linear'); } e.find('ul li.on').removeClass('on'); e.find('ul li:eq('+num+')').addClass('on'); no = num + 1; if(no > len) no = 0; } e.find('ul').css({'width' : o.width, 'overflow' : 'hidden', 'position' : 'relative', 'height' : o.height}); e.find('ul li').each(function(i){ $(this).css({'position' : 'absolute' , 'overflow' : 'hidden', 'width' : o.i_width, 'height' : o.height}); if(i > o.start) $(this).css({'position' : 'absolute', 'left' : h_width*(i-1)+o.i_width}); else $(this).css({'position' : 'absolute', 'left' : h_width*i}); e.find('ul li:eq('+o.start+')').addClass('on'); }); //return; e.find('ul li').each(function(i){ $(this).find('img').mouseover(function(){ pause = true; if(e.find(':animated').length == 0 && !$(this).hasClass('on')){ ani(i); } }).mouseleave(function(){pause = false;}); }); setInterval(function(){ if(pause == false) ani(no); },o.delay); }); } })(jQuery);