IOS下双击背景, touchmove, 阻止页面背景scroll.

时间:2022-10-05 11:20:19

ios prevent dblclick(tap) page scroll
html add:("minimal-ui" is very important)

<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,usker-scalable=no,minimal-ui">

eg: 以lightbox_me.js举例说明

var opt = {
centered: true,
zIndex: 99999,
overlaySpeed: 1,
lightboxSpeed: 1,
preventScroll: true,
showOverlay: true,
onClose: function(){
$('.js_lb_overlay').remove();
$('section').unbind('touchmove');//$('section') is page's element
},
onLoad: function(){
$('section').on('touchmove', function (e) {
e.preventDefault();
});
$('.js_lb_overlay').on('touchstart', function (e) {// touchstart!!!
e.preventDefault();
});
},
closeSelector:'.js_close',
overlayCSS:{background: '#000000', opacity:0.7}
};