我在 jquery 中测试鼠标是否按下的功能总是 returns false
my function in jquery that is testing if the mouse is down always returns false
我正在尝试测试鼠标是否已按下,因此使用 mousedown() 我尝试将 down 的值设置为 true,但这从未发生过。
这是代码
function checkDown()
{
var down = false;
$(document).mousedown(()=>{down = true;});
return down;
}
在全局和事件侦听器中向下移动到全局;
var down = false; // by default will be false
$(document).mousedown(()=>{down = true;});// when mouse will be down it will make it true
function checkDown()
{
return down;// returns the current status of down
}
我正在尝试测试鼠标是否已按下,因此使用 mousedown() 我尝试将 down 的值设置为 true,但这从未发生过。
这是代码
function checkDown()
{
var down = false;
$(document).mousedown(()=>{down = true;});
return down;
}
在全局和事件侦听器中向下移动到全局;
var down = false; // by default will be false
$(document).mousedown(()=>{down = true;});// when mouse will be down it will make it true
function checkDown()
{
return down;// returns the current status of down
}