Conditionally block scrolling/touchmove event in mobile safari

后端 未结 6 1598
暗喜
暗喜 2021-02-03 13:46

iOS 5 now allows native overflow: scroll support.

What I\'d like to do is disable the touchmove event for everything except elements that have the \'scrolla

6条回答
  •  青春惊慌失措
    2021-02-03 14:28

    I tried Scott's answer but it didn't work on my iphone iOS 5.1.1

    Also, this is particularly important if you're building a webClip app, gosh I do hope iOS 6 will allow a viewport tag that disables the auto-bounce

    My version below works (or doesn't) as well as Scott's answer above, as it essentially does the same thing.

    jQuery 1.7.2

            $(document).bind("touchmove",function(e){
                e.preventDefault();
            });
            $('.scrollable').bind("touchmove",function(e){
                e.stopPropagation();
            });
    

提交回复
热议问题