gpt4 book ai didi

当鼠标在图像上移动时,jQuery mouseup 不会被触发

转载 作者:行者123 更新时间:2023-12-03 23:05:42 27 4
gpt4 key购买 nike

当您在图像上 mousedown 时,稍微移动鼠标 (mousemove),然后松开 (mouseup), mouseup 不是用 jQuery 触发的。

jsfiddle:http://jsfiddle.net/kVFTZ/

这是为什么呢?在图像上移动时如何使其工作?

最佳答案

很容易修复。将 event.preventDefault(); 添加到 mousedown 函数中。

<强> jsFiddle example

$(document).on('mousedown', function(event) {
event.preventDefault();
$('#info').text('Now move the mouse and then release');
$('#log').text('mouse down fired');
}).on('mouseup', function() {
$('#log').text('mouse up fired');
});

关于当鼠标在图像上移动时,jQuery mouseup 不会被触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14008468/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com