0

これはここでテストできます: http://jsfiddle.net/rGECn/2/

この問題の回避策はありますか?

更新 1:

transitionendin window は false を返します。

4

1 に答える 1

0

CSS にいくつかのベンダー プレフィックスがありません。

button {
    width: 100px;
    -moz-transition: all 1s;
    -o-transition: all 1s;
    -webkit-transition: all 1s;
    transition: all 1s;
}

この互換表によると、 s は IE10 でのみサポートされているため、クロスブラウザー ソリューションにはtransitionjQuery のメソッドを使用することをお勧めします。animate

$('button').click(function() {
    var toggle = [100, 150],
        $this = $(this),
        c = $this.data('count') + 1;
    $this.data('count', c);
    $this.stop(true).animate({'width': toggle[c % toggle.length]}, 1000, function() {
        //done callback
        count();
    });
}).data('count', 0);

フィドル

.stop(true)アニメーション中にユーザーがクリックしたときにアニメーションを中断するのではなく、アニメーションをキューに入れたい場合は、 を削除します。

于 2012-09-21T02:18:00.527 に答える