$('#imgtest').click(function(e){ //获取鼠标在图片上的坐标 alert('X:'+e.offsetX+'\n Y:'+e.offsetY); //获取元素相对于页面的坐标 alert('X:'+$(this).offset().left+'\n Y:'+$(this).offset().top) });
转载于:https://www.cnblogs.com/Liu-yz/p/10382407.html
$('#imgtest').click(function(e){ //获取鼠标在图片上的坐标 alert('X:'+e.offsetX+'\n Y:'+e.offsetY); //获取元素相对于页面的坐标 alert('X:'+$(this).offset().left+'\n Y:'+$(this).offset().top) });
转载于:https://www.cnblogs.com/Liu-yz/p/10382407.html