Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/467.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript w3school幻灯片放映的Swiperight和swipeleft手势_Javascript_Jquery_Html_Css_Swipe Gesture - Fatal编程技术网

Javascript w3school幻灯片放映的Swiperight和swipeleft手势

Javascript w3school幻灯片放映的Swiperight和swipeleft手势,javascript,jquery,html,css,swipe-gesture,Javascript,Jquery,Html,Css,Swipe Gesture,我对jquery swiperight和swipeleft手势有问题 我有两个幻灯片,第一个是引导旋转木马,第二个是灵感来源 我在这页的某个地方找到了引导的好方法。这是代码。它工作得很好 $(document).ready(function() { $(".carousel").swiperight(function() { $(this).carousel('prev'); }); $(".carousel").swipeleft(function()

我对jquery swiperight和swipeleft手势有问题

我有两个幻灯片,第一个是引导旋转木马,第二个是灵感来源

我在这页的某个地方找到了引导的好方法。这是代码。它工作得很好

$(document).ready(function() {
    $(".carousel").swiperight(function() {
        $(this).carousel('prev');
    });
    $(".carousel").swipeleft(function() {
        $(this).carousel('next');
    });
}); 
但是,如果我想将此代码包含并修改为源代码,它将无法工作。因此,我尝试了类似的方法(在codepen中不起作用,我不知道为什么…)

如果我滑动它,它会滑动多个图像

有没有办法解决这个手势问题


这里是

这只是jquery版本的问题。使用函数和的文档,这些版本的jquery解决了这个问题:

src="//code.jquery.com/jquery-3.2.1.min.js"></script>
  <script src="//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js"></script>

您可以查看这个工作片段:

首先在代码笔中,将其添加到顶部的
HTML
-->
,这非常有效。我想你只需要等待
JS
加载,可能是因为它看起来很有效。谢谢你的回答,但我不想包含w3.css,我也不知道为什么我应该包含它。Css和js(来自w3school)不是问题。问题在于jquery的滑动手势。代码不好用,还是手势适合你@YlamaNo我理解错了,无法删除我的评论,我看到现在刷不起作用了。这是jquery版本的问题。考虑一下我对问题的回答,谢谢。在我的项目中,我刚刚编辑了函数,最后它工作得很好。在codepen中,jquery版本存在问题,您是如何说的。再次感谢:)
src="//code.jquery.com/jquery-3.2.1.min.js"></script>
  <script src="//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js"></script>
function swipeleftHandler( ){
    plusSlides(1);
  }
  function swiperightHandler( ){
    plusSlides(-1);
  }