哪里该物业的MouseEvent从何而来? [英] Where does this MouseEvent property come from?
问题描述
我有这样的jsfiddle该报告的X,即鼠标按钮被释放时被周围用鼠标移动的白色方块,y坐标。
I have this jsfiddle which reports the x,y coordinates of a white square that is being moved around by the mouse when the mouse button is released.
http://jsfiddle.net/35z4J/115/
在code的这部分有助于报告的X,广场中心的y坐标。
This part of the code helps to report the x,y coordinates of the centre of the square.
stop: function(e) {
console.log("STOPPING");
var divheight= e.path[0].offsetHeight;
var divWidth= e.path[0].offsetWidth;
console.log(e.clientX+divWidth/2)
console.log(e.clientY+divheight/2)
},
从上面的两行code的困惑我有;
The 2 lines of code from the above that puzzles me are;
var divheight= e.path[0].offsetHeight;
var divWidth= e.path[0].offsetWidth;
我看着的MouseEvent文档。
https://developer.mozilla.org/en-US/docs/Web / API / 的MouseEvent
我找不到关于 path.offsetHeight
和 path.OffsetWidth
东西。那些是什么?我在哪里可以找到相关文档?
I looked at the MouseEvent documentation.
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
I cannot find anything about path.offsetHeight
and path.OffsetWidth
. What are those? Where can I find the relevant documentation?
推荐答案
的路径
是包含在树为了所有祖先事件对象的属性。
The path
is a property of the event object which contains all the ancestors in tree order.
请参阅调度事件
如果事件的目标属性值将参加在树上,让
事件路径是它在树中的所有祖先的静态有序列表
秩序,让事件的路径是空表,否则。
If event’s target attribute value is participating in a tree, let event path be a static ordered list of all its ancestors in tree order, and let event path be the empty list otherwise.
所以 e.path [0]
将引用元素从那里事件起源。然后元拥有的的offsetHeight 财产
So e.path[0]
will refer to the element from where the event was originated. Then the Element has the offsetHeight property
这篇关于哪里该物业的MouseEvent从何而来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!