IOS下:active无效

IOS下:active无效,是因为该元素没有绑定touch事件。因此在IOS系统的移动设备中,需要在按钮元素或body/html上绑定touchstart/touchend绑定一个空的匿名函数即可

<script>
    var a=document.getElementsByTagName('a');
    for(var i=0;i<a.length;i++){
    a[i].addEventListener('touchstart',function(){},false);
}
</script>

 

posted @ 2016-06-14 09:44  七月上  阅读(411)  评论(0编辑  收藏  举报