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-12-23
  • 2021-09-09
  • 2022-01-29
  • 2021-12-07
  • 2021-08-28
  • 2022-02-07
  • 2021-10-20
猜你喜欢
  • 2021-05-16
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
相关资源
相似解决方案