(function($) { $.extend({ textScrollInit : function (o, countdown){ $(o.fncClsid).mouseover(function(){ if( o.bRunning ) clearInterval($.textScroll.optcont[countdown].timeidx); o.bRunning = false; $(o.fncClsid).removeClass('on'); $(o.vwClsid).hide(); $(this).addClass('on'); $('#'+$(this).attr('destlayer')).show(); }).mouseout(function(){ var timeidx = $.setScrollInterval(countdown,o.iRunSpeed); $.textScroll.optcont[countdown].timeidx = timeidx; o.bRunning = true; }); $(o.vwClsid).bind("mouseenter",function(){ if( o.bRunning ) clearInterval($.textScroll.optcont[countdown].timeidx); o.bRunning = false; $(o.fncClsid).removeClass('on'); $(o.vwClsid).hide(); var cuid = $(this).attr('id'); $(o.fncClsid+"[destlayer='"+cuid+"']").addClass('on'); $('#'+$(this).attr('id')).show(); }).bind("mouseleave",function(){ var timeidx = $.setScrollInterval(countdown,o.iRunSpeed); $.textScroll.optcont[countdown].timeidx = timeidx; o.bRunning = true; }); }, textScroll : function (opti){ var o = $.textScroll.optcont[opti]; if( o.bRunning ){ $(o.fncClsid).each(function(idx){ if( idx==o.curidx ){ $(this).addClass('on'); $('#'+$(this).attr('destlayer')).show(); }else{ $(this).removeClass('on'); $('#'+$(this).attr('destlayer')).hide(); } }); o.curidx++; if( o.curidx + 1 > $(o.fncClsid).length ){ o.curidx = 0; } } }, textScrollStart : function (options){ var defaults = { bRunning: false, curidx: 0, iRunSpeed: 2000, fncClsid: '.txtScrollList', vwClsid:'.viewlayerArea' } var opts = $.extend({}, defaults, options); $.textScroll.optcont[$.textScroll.optcount] = opts; $.textScrollInit(opts,$.textScroll.optcount); //window.setTimeout("$.textScroll("+$.textScroll.optcount+");",opts.iRunSpeed); var timeidx = $.setScrollInterval($.textScroll.optcount,opts.iRunSpeed); $.textScroll.optcont[$.textScroll.optcount].timeidx = timeidx; opts.bRunning = true; $.textScroll.optcount++; }, setScrollInterval : function(optidx,speed){ return window.setInterval("$.textScroll("+optidx+");",speed); } }); $.textScroll.optcount = 0; $.textScroll.optcont = new Array(); })(jQuery);