1. 通过触发某事件,该事件相对document左上角的位置:

 

BasicUtils.event.getPosition = function(e) {

    e = e || window.event;

    var pos = {};

    if(typeof e.pageX !== "undefined") {

       return {x: e.pageX, y: e.pageY}

    }

    return {

       x: e.clientX + (document.body.scrollLeft || document.documentElement.scrollLeft) ,

       y: e.clientY + (document.body.scrollTop || document.documentElement.scrollTop)

   }

}

相关文章:

  • 2022-01-14
  • 2022-12-23
  • 2021-09-09
  • 2021-09-17
  • 2021-12-07
  • 2021-08-28
猜你喜欢
  • 2021-09-17
  • 2022-01-25
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案