【问题标题】:What is the structure of VML mouse event object?VML鼠标事件对象的结构是什么?
【发布时间】:2012-07-09 14:07:33
【问题描述】:

我想知道 VML 鼠标事件对象的结构(属性和方法)。

我正在使用 Raphael,我想知道元素悬停时的鼠标坐标。在 Firefox 和 Chrome 上,event.pageXevent.pageY 可以正常工作,但在 IE8 中不行。

var paper = Raphael(document.getElementById('map', 300, 300));
paper.circle(50, 50, 40).attr({fill: 'black'}).mouseover(function(event){
    alert(event.pageX);
});

这里是JSFiddle

【问题讨论】:

    标签: raphael vml


    【解决方案1】:

    事实上,它并不特定于 VML:所有鼠标事件在 IE 中具有相同的结构。 我使用了clientXclientY,由于clientX 是相对于视口的偏移量,而pageX 是相对于页面的偏移量,因此进行了修正。

    【讨论】:

      猜你喜欢
      • 2015-02-26
      • 2013-03-26
      • 2014-05-24
      • 1970-01-01
      • 2013-01-13
      • 2021-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多