IE10不处理单击事件|帮助使用MSPointer [英] IE10 is not Handling Click Events | Help Using MSPointer
问题描述
请原谅我提前作为一个stoopid noob。
Please forgive me in advance for being a stoopid noob.
无论如何,我试图让我的html5游戏在IE10,
,但它没有检测到我的点击。
Anyway, I'm trying to make my html5 game play on IE10, but it's not detecting my clicks.
所以我研究一下,发现,而不是理解这是什么意思:
So I research this a bit and find out that instead of understanding what this means:
document.getElementById(answer1)。addEventListener(click,wrong,false);
如果必须使用一些crappy专有代码。
因为我是一个stoopid noob,我有问题
实现这个。
If have to use some crappy proprietary code. Because I am a stoopid noob, I am having problems implementing this.
这是我目前的
document.getElementById("answer1").addEventListener("click", wrong, false);
document.getElementById("answer2").addEventListener("click", wrong, false);
document.getElementById("answer3").addEventListener("click", wrong, false);
document.getElementById("answer4").addEventListener("click", wrong, false);
//Stupid IE10 Crap
if (window.navigator.msPointerEnabled) {
document.getElementById("answer1").addEventListener("MSPointerDown", wrong, false);
document.getElementById("answer2").addEventListener("MSPointerDown", wrong, false);
document.getElementById("answer3").addEventListener("MSPointerDown", wrong, false);
document.getElementById("answer4").addEventListener("MSPointerDown", wrong, false);
}
当我在ie10上运行代码时,它仍然不注册我的鼠标点击。
我错过了什么或做错了什么?
When I run the code on ie10, it still doesn't register my mouse clicks. Am I missing something or doing something incorrectly?
请帮助我。
推荐答案
好吧,我不为什么它不工作。
它仍然不工作。
Well, I do not why it wasn't working. It's still not working.
但我发现了一个解决方法,我认为我会分享。
我为目标DIV的CSS添加了以下属性。
But I found a workaround that I thought that I would share. I added the following attributes to CSS of the target DIVs.
background-color:#FFFFFF;
opacity:0;
由于某种原因,如果我给DIVS一个背景颜色, $ b的点击注册。
For some reason, if I give the DIVS a background color and make them totally transparent, the clicks register.
所以,我现在做了关心这个问题。
So, I'm done caring about this problem for now.
希望这有助于某人。
这篇关于IE10不处理单击事件|帮助使用MSPointer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!