首页 > 怎么阻止js的touch事件冒泡

怎么阻止js的touch事件冒泡

我在父元素绑定了touchstart,touchmove和touchend事件,在子元素绑定了touchstart事件,触摸子元素的时候会触发父元素的事件,而stopPropagation并不能阻止touchend,怎么做比较好


试试

event.stopImmediatePropagation();

不过冒泡估计没办法去阻止了。最好检查状态改变
还有如果touch的是元素的margin就不会bubble
.


子元素的touchend也stopPropagation

【热门文章】
【热门文章】