Zac*_*ous 7 jquery touchscreen touch scrollview
我一直在使用jQuery滚动视图.该脚本似乎不支持触摸屏,所以我花了大部分时间试图弄清楚如何为脚本添加触摸屏支持.
我考虑过切换到jQuery draggable,但它不能像上面的脚本看起来那样工作.
有人可以给我一些关于如何为此添加触摸支持的指示或提示吗?
使用jquery.mouse2touch.min.js插件来模拟鼠标事件进行触摸事件。
注意:我看到您在原始插件jquery.scrollview.js中做了一些代码更改以添加触摸事件。请使用原始的,$("#elment").mouse2touch()将鼠标事件处理程序行为应用于触摸事件。
应用此 FIX 的步骤
jquery.min.js jquery.scrollview.js jquery.mouse2touch.min.js$("#map").scrollview().mouse2touch()下面是代码
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="//increstedbutte.com/wp-content/themes/crestedbutte/style.css" />
</head>
<body>
<h1>Scroll Demo Plunker!</h1>
<div id="map">
<div id="spring" style="opacity: 1;">
<img width="3800" height="1200" src="http://increstedbutte.com/wp-content/uploads/2013/07/crested-butte-town-map_spring-v2.jpg" class="attachment- wp-post-image" alt="Crested Butte Town Map - Spring">
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//jquery-scrollview.googlecode.com/svn-history/r2/trunk/jquery.scrollview.js"></script>
<script src="//cdn.rawgit.com/vpanga/jquery.mouse2touch/master/src/jquery.mouse2touch.min.js"></script>
<script>
$(function() {
$("#map").scrollview().mouse2touch();
});
</script>
</body>
</html>Run Code Online (Sandbox Code Playgroud)