简体   繁体   English

要延迟鼠标光标后的图像

[英]Want to delay image following my mouse cursor

$(document).mousemove(function(e){
$("#butterfly").delay(90000);
$("#butterfly").css({left:e.pageX, top:e.pageY});
   });

How to create delay in image following the cursor. 如何在光标之后创建图像延迟。 #butterfly is "img id="butterfly" element. #butterfly是“ img id =“ butterfly”元素。

Use setTimeout , delay will not work with .css() . 使用setTimeoutdelay将不适用于.css() As it is used to delay the execution of functions that follow it in the queue . 因为它用于延迟队列中跟在其后的功能的执行。

$(document).mousemove(function (e) {
    setTimeout(function () {
        $("#butterfly").css({
            left: e.pageX,
            top: e.pageY
        });
    }, 90000);
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM