如何給我的腳本添加一個定時器?我想讓「mouseenter」函數在啓動之前等待1秒鐘。帶定時器的Mouseenter功能
$(".products_grid li").mouseenter(function(){
var $activeImage = $(this).find("img").attr("src");
var $imgZoom = '<div class="imgzoom"><img src="'+$activeImage+'" width="" height=""></div>';
$($imgZoom).hide().appendTo(this).fadeIn();
}).mouseleave(function(){
$("div.imgzoom").fadeOut().remove();
})
https://developer.mozilla.org/en-US/docs/Web/API/window.setTimeout – j08691