$('#myImage').click(function(event){ //获取鼠标在图片上的坐标 console.log('X:' + event.offsetX+'\n Y:' + event.offsetY); //获取元素相对于页面的坐标 console.log('X:'+$(this).offset().left+'\n Y:'+$(this).offset().top);});
文章转载于:https://www.jianshu.com/p/248f22d52a54
原著是一个有趣的人,若有侵权,请通知删除
还没有人抢沙发呢~