Surface Internet Explorer 11 Javascript PointerEvents问题

时间:2014-03-25 14:25:50

标签: javascript touch internet-explorer-11 pointer-events

我试图在Surface平板电脑上尝试使用Internet Explorer 11的Pointer API,但我遇到了一些问题。

我做一个小提琴解释得更好(请打开控制台试试):Fiddle

(function() {
    "use strict";

    function onEvent(e) {
        console.log(e.type + ' ' + e.pageX + '/' + e.pageY);
    }

    if (window.PointerEvent) {
        window.addEventListener('pointerdown', onEvent);
        window.addEventListener('pointerup', onEvent);
        window.addEventListener('pointerout', onEvent);
    } else if (window.MSPointerEvent) {
        window.addEventListener('MSPointerDown', onEvent);
        window.addEventListener('MSPointerUp', onEvent);
        window.addEventListener('MSPointerOut', onEvent);
    }
})();

如果您将手指放在“结果”区域,则会在屏幕上用手指位置触发指针向下事件。直到这里,一切都很顺利。

但是,如果移动手指,指针会主要以相同的位置触发,有时位置不同,指针永远不会被触发。

我在使用Windows 8.1和Internet Explorer 11的另一台平板电脑上尝试相同的代码,我也有相同的行为。

有人对此有任何想法吗?

谢谢。

0 个答案:

没有答案
相关问题