1

スクリプトの修正を手伝ってください: http://jsfiddle.net/b36cM/

                if(direction == -1){
                    wrapperElements.children(':last').after($('#carousel > ul').children().slice(0, options.rotateBy).clone());

                    shiftAction();

                    wrapperElements.children().slice(0, options.rotateBy).remove();
                }
                else{
                    // wrapperElements.children(':first').after($('#carousel > ul').children().slice(carouselLength - options.rotateBy, carouselLength).clone());

                    // shiftAction();

                    // wrapperElements.children().slice(carouselLength - options.rotateBy, carouselLength).remove();
                }               
            }

            function shiftAction(){
                console.log(offset);

                wrapperElements.animate({
                    'left': offset                  
                }, options.speed,   function(){
                                        running = false;
                                    });                 
            }               
        }

アニメーションをクリックすると#prev、2 つの要素が左にシフトします。1項目だけスムーズにスクロールしたい。

4

1 に答える 1

0

shiftAction() と remove() は非同期で実行されるため、要素が削除されたときにアニメーションが終了せず、確認できる最初の要素にアニメーションがジャンプすることに注意してください

setTimeout(function() {
      wrapperElements.children().slice(0, options.rotateBy).remove();
       },5000);

しかし、それはアニメーションの穴の問題を解決していません

于 2013-07-09T13:00:42.223 に答える