gpt4 book ai didi

jquery - 在 jQuery 中使用鼠标位置设置单击事件

转载 作者:行者123 更新时间:2023-12-01 04:21:05 25 4
gpt4 key购买 nike

谁能告诉我如何将点击功能分配给元素内的特定坐标?

最佳答案

$(document).click(function(event) {
var top = 0,
right = 200,
bottom = 200,
left = 0;


var x = event.pageX;
var y = event.pageY;
if ((x >= left && x <= right) && (y >= top && y <= bottom))
{
// do stuff if within the rectangle
}
});

关于jquery - 在 jQuery 中使用鼠标位置设置单击事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10580046/

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