是否可以检测到视口被触摸事件拖动?
使用以下代码,我可以获取手指触摸屏幕的位置、启动事件的节点以及拖动到的位置。这解决了其中一个问题,但我真的很想检测用户何时向下拖动页面/窗口/视口。
为了更清楚地了解我想要做什么:我想在 Tweetie 2/Twitter for iPhone 中模拟刷新活动,但在 HTML5 和 JavaScript 中。
<script>
window.ontouchmove = function(e){
if(e.touches.length == 1){ // Only deal with one finger
var touch = e.touches[0]; // Get the information for finger #1
var node = touch.target; // Find the node the drag started from
$("p:last").html(
"clienty: " + touch.clientY + "<br/>" +
"screenY: " + touch.screenY + "<br/>" +
"pageY: " + touch.pageY
);
}
}
</script>