为什么这个 Bootstrap Carousel 滑动功能对我不起作用? [英] Why won't this Bootstrap Carousel swipe function work for me?
问题描述
我找到了这个代码笔:https://codepen.io/andrearufo/pen/rVWpyE
而且我很想使用它,但由于某种原因它对我不起作用,即使我复制它而不更改任何内容.这是为什么?
我没有忘记嵌入 bootstrap 和 jquery.
我还尝试了其他用于滑动功能的解决方案,但由于某种原因,它们都不起作用.唯一可以滑动的旋转木马(我曾在 Google Chrome 开发者工具中尝试过)在这个 codepen 上.
$(".carousel").swipe({滑动:功能(事件,方向,距离,持续时间,fingerCount,fingerData){if (direction == 'left') $(this).carousel('next');if (direction == 'right') $(this).carousel('prev');},allowPageScroll:"垂直"});
<div class="page-header"><h1>带有滑动和触摸手势的 Bootstrap 默认轮播</h1><p class="lead">如何在移动设备上添加滑动手势以命令 Bootstrap 轮播.</p><p>由 <strong>Andrea Rufo</strong> 制作,有关 <a href="http://www.orangedropdesign.com/"> 的更多信息和教程OrangeDropDesign.com</a></p><div id="carousel-example-generic" class="carousel slide" data-ride="carousel"><!-- 指标--><ol class="carousel-indicators"><li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li><li data-target="#carousel-example-generic" data-slide-to="1"></li><li data-target="#carousel-example-generic" data-slide-to="2"></li><li data-target="#carousel-example-generic" data-slide-to="3"></li><li data-target="#carousel-example-generic" data-slide-to="4"></li></ol><!-- 幻灯片包装器--><div class="carousel-inner" role="listbox"><div class="item active"><img src="https://unsplash.it/1400/600?image=114">
<div class="item"><img src="https://unsplash.it/1400/600?image=745">
<div class="item"><img src="https://unsplash.it/1400/600?image=315">
<div class="item"><img src="https://unsplash.it/1400/600?image=622">
<div class="item"><img src="https://unsplash.it/1400/600?image=401">