谁能告诉我如何将点击功能分配给元素内的特定坐标?
最佳答案
$(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/