0
$("#notification").slideDown("slow").delay(2000).slideUp("slow");

..動作しますが、#notificationにカーソルを合わせると、マウスアウトするまでタイマー/遅延が停止するように条件を追加したいと思います。次に、マウスアウトするとタイマーが開始し、最終的に要素が非表示になります(再度ホバーしない限り)。

ありがとう!

4

2 に答える 2

2

私があなたを正しく理解していれば、要素にカーソルを合わせたときに遅延/アニメーションを停止できるようにしたいですか?

clearQueue()そのために使う

$(document).ready(function() {
    if(cookieIsPresent) {
        $("#notification").hover(function() {
            $(this).stop(true, true).clearQueue(); // You might not need to use clearQueue() but test it out
        }, function() {
            $(this).delay(2000).slideUp("slow");
        }).slideDown("slow").delay(2000).slideUp("slow");
    }
});
于 2010-09-14T07:52:04.133 に答える
0

onmouseover (onmouseover ではない) イベントを処理してみてください。

于 2010-09-14T07:55:52.763 に答える