[英]why doesn't work TouchSwipe jQuery plugin in my code
我使用我代码中的TouchSwipe jQuery插件来检测鼠标移动并向左或向右显示像素移动。
我从以下地址下载TouchSwipe jQuery插件: TouchSwipe并在我的代码中使用...
这是我的代码:
HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/Newsfeed.css" media="screen" type="text/css" rel="stylesheet"/>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.easing.1.3.min.js" type="text/javascript"></script>
<script src="js/jquery.touchSwipe.js" type="text/javascript"></script>
<script src="js/Newsfeed.js" type="text/javascript"></script>
</head>
<body>
<div id="fullpage">
<div class="content-part selected"></div>
<div class="content-part selected"></div>
<div class="content-part selected"></div>
<div class="content-part selected"></div>
</div>
</body>
</html>
jQuery的:
$(document).ready(function() {
$('#fullpage .selected').swipe( {
swipeStatus:function(event, phase, direction, distance, duration)
{
var str = "";
if (phase == "move")
str="You have moved " + distance +" px, If you leave the swipe object, the swipe will end";
if (phase == "end")
str="The swipe has ended"
$(this).text(str);
},
triggerOnTouchLeave:true,
threshold:null
});
});
但是此jQuery代码无法正常工作,请帮助我。...XD
您最后的js部分以“:”而不是“;”结尾,也许就是问题所在?
编辑:
我自己尝试了该代码,它工作正常,您的“整页”和“选定”的div是否具有高度和宽度?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.