问题描述
我正在使用Pep.js进行多点触摸的动态拖动,但是我的拖动事件没有被注册,因为当我尝试在Safari中拖动对象时,在iOS上,窗口本身移动并跟随我的拖动。
I am using Pep.js for kinetic drag on multi-touch, but my drag events are not being registered because when I try to drag an object in the safari, on iOS, window the window itself moves and follows my drag.
如何防止浏览器窗口跟踪我的拖动,以便我的网页中的< div>
可以被拖?
How can I prevent the browser window from following my drag so that the <div>
in my webpage can be dragged?
以下是相关网页:。点击链接并输入< div>
幻灯片,这是可拖动的div。它适用于桌面浏览器,但无法在多点触控时拖动,因为Safari会随着我的拖动移动窗口。
Here is the webpage in question: http://goo.gl/TsHgh. Click on the link and a <div>
slides in, it is that div that is draggable. It works on desktop browsers, but can not be dragged on multi-touch because safari moves the window along with my drag.
推荐答案
我在使用
CSS时找到了这个解决方案:
CSS:
html, body {
overflow:hidden;
}
JS:
$(window).bind(
'touchmove',
function(e) {
e.preventDefault();
}
);
这篇关于阻止iOS Safari访问移动网页窗口,以便可以进行拖动事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!