0

以下の場合、ホバー機能のセレクターを取得する$(this)にはどうすればよいですか。setTimeoutimg

$("img").hover(function(){
window.setTimeout(function() {  
    $(this).addClass("hovering"); // add class .hovering to the exact img being hovered
}, 500);  
});
4

1 に答える 1

1

this他の変数を入れます。

$("img").hover(function() {
    var $this = $(this);

    window.setTimeout(function() {  
        $this.addClass("hovering"); // add class .hovering to the exact img being hovered
    }, 500);  
});
于 2012-04-28T15:45:09.057 に答える