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)
}
}