为什么不;我的代码中没有TouchSwipejQuery插件

why doesn't work TouchSwipe jQuery plugin in my code

本文关键字:TouchSwipejQuery 插件 我的 代码 为什么不      更新时间:2024-04-12

我在代码中使用来自TouchSwipe的jQuery插件来检测鼠标的移动,并在向左或向右移动时显示像素移动。

我从以下地址下载TouchSwipejQuery插件: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部分以":"而不是";"结尾,也许这就是问题所在?

编辑:

我自己尝试过代码,它运行得很好,你的"fullpage"answers"selected"div有高度和宽度吗?

相关文章:
  • 没有找到相关文章