Javascript では、onmouseout イベントが有効になる前に 3 秒間スリープ/一時停止/待機/ (ここでは適切な用語がわからない) する必要があります。それはどのように達成されますか?
ありがとう
Javascript では、onmouseout イベントが有効になる前に 3 秒間スリープ/一時停止/待機/ (ここでは適切な用語がわからない) する必要があります。それはどのように達成されますか?
ありがとう
function outfunction(event) {
    var that = this; // to be able to use this later.
    window.setTimeout(function() {
        …
    /* you can use 'that' here to refer to the element
       event is also available in this scope */
    }, 3000);
}
    var doSomething = function () {
    //Some code will here after 3 seconds of mouseout
};
anElement.onmouseout = function () {
   setTimeout(doSomething, 3000);
};
上記のコードが行うことは、呼び出されてdoSomethingから 3 秒後に関数を実行することです。onmouseout