(function($){ $.fn.textSlide = function (options) { var defaults = { total:6, speed:1200, autoView: true }; var cTarget = $(this); var el = this; var cCurIndex = 0; var options = $.extend({},defaults,options); total = cTarget.find('li').length; console.log("total :" + total ); var moveWidth = cTarget.parent().width(); console.log("moveWidth :" + moveWidth ); var ScreenInit2 = { _start:function(){ cTarget.find('li').fadeOut(0); TweenMax.set( cTarget.find('li .title'),{y:50,alpha:0}); TweenMax.set( cTarget.find('li .info'),{y:50,alpha:0}); }, _reset:function( cIndex ){ console.log("clear : "+ cIndex ); cTarget.find('li').eq(cIndex).fadeOut(400); TweenMax.set( cTarget.find('li .title'),{y:50,alpha:0}); TweenMax.set( cTarget.find('li .info'),{y:50,alpha:0}); } } var ScreenView2 = { _ViewStep:function( cIndex ) { RealMoveWidth = moveWidth*cIndex; RvsMoveWidth = moveWidth*(total- cIndex ); console.log("show : "+ cIndex ); //console.log("moveWidth:"+ RealMoveWidth ); cTarget.find('li').eq(cIndex).fadeIn(900); TweenMax.to( cTarget.find('li .title').eq(cIndex),0.8,{y:0,alpha:1,delay:1,ease:Quad.easeOut}); TweenMax.to( cTarget.find('li .info').eq(cIndex),0.8,{y:0,alpha:1,delay:1.2,ease:Quad.easeOut}); } } el.nextSlide = function(){ if( cflg == 0 ) { ScreenView2._ViewStep(cCurIndex); cflg = 1; } } el.ResetSlide = function(){ if( cflg == 1 ) { ScreenInit2._reset(cCurIndex ); cCurIndex++; if( cCurIndex >= total ) cCurIndex = 0; cflg = 0; } } ScreenInit2._start(); cflg=0; ctimer = 0; var setinter = setInterval(function(){ if( cflg == 0 && ctimer == 0 ) { ScreenView2._ViewStep(cCurIndex); cflg = 1; } if( cflg == 1 && ctimer == 4 ) { ScreenInit2._reset(cCurIndex ); cCurIndex++; if( cCurIndex >= total ) cCurIndex = 0; cflg = 0; ctimer = -1; } ctimer++; },options.speed ); if( options.autoView == false ) { clearInterval(setinter); } return this; }; })(jQuery);