1

I have attached a touchstart event to my fixed positioned footer in a web-app

so the structure is like this:

<div id="content">i am a looong content.</div>
<div id="footer">i am tappable!</div>

and the code like this:

$("#footer").on('touchstart', function(e) { alert("tapped"); });

The problem is that when I scroll down the page to read the (long) content, the touchstart event for my footer just stops working! it does not get called anymore.

Does anyone have any idea why this might be happening? Thanks in advance.

4

1 回答 1

0

我可以建议使用 click 代替,这样每次都会调用它。

var idFooter = document.getElementById("footer");
idFooter.addEventListener("click", touched, false);

function touched(){
 alert("tapped");
}

您是否尝试使用绑定而不是用户?

您也可以使用 touchend 来查看它的效果更好。

于 2013-04-07T13:41:46.530 回答