如何阻止停止传播到达文档

时间:2014-02-07 13:44:28

标签: javascript

如果这样做:

$('body').bind('touchmove',function(e){
    e.preventDefault();
    });
$('#scrollarea').bind('touchmove',function(e){
    e.stopPropagation();
    });

然后身体可以不再滚动但是,如果我滚动#scrollarea stopPropagation重新启用文档的滚动...

当它冒泡到文档时如何停止stopPropagation?

1 个答案:

答案 0 :(得分:0)

您是否尝试添加冒泡的第三个参数?

$('#scrollarea').bind('touchmove',function(e){
    e.stopPropagation();
}, true);