美文网首页
JQuery Hover 事件延迟响应

JQuery Hover 事件延迟响应

作者: Messix_1102 | 来源:发表于2021-04-12 10:54 被阅读0次
// 全局变量
var timeoutJob;
$('td').hover(function (e) {
    // 鼠标移入,设置延时方法
    if (e.type == "mouseenter") {
        timeoutJob = setTimeout(function () {
            // 
            //  具体功能
            // 
        }, 1000);
    } else { //  鼠标移出,清理延时方法
        clearTimeout(timeoutJob);
    }
});

相关文章

网友评论

      本文标题:JQuery Hover 事件延迟响应

      本文链接:https://www.haomeiwen.com/subject/tyntlltx.html