因此,我正在为使用iDangerous Swiper插件的移动网站创建图像选取框,并在尝试使用它时遇到问题。根据基于站点found here的设置,我按照他们的演示的确切说明构建了演示页面。但是由于某种原因,该功能未运行,我无法滑动至下一个div。作为一个移动网站,我正在使用Jquery和Jquery Mobile。有任何想法吗?

<body>

<div class="swiper-container">
  <div class="swiper-wrapper">

      <!--First Slide-->
      <div class="swiper-slide">
       <img src="img/1.png" width="200" height="118">
      </div>

      <!--Second Slide-->
      <div class="swiper-slide">
       <img src="img/2.png" width="200" height="118">
      </div>

      <!--Third Slide-->
      <div class="swiper-slide">
        <img src="img/3.png" width="200" height="118">
      </div>

      <!--Fourth Slide-->
      <div class="swiper-slide">
       <img src="img/4.png" width="200" height="118">
      </div>

      <!--Fifth Slide-->
      <div class="swiper-slide">
        <img src="img/5.png" width="200" height="118">
      </div>

  </div>
</div>

<script>

$(function(){
    var mySwiper = $('.swiper-container').swiper(options);
})

</script>
</body>

最佳答案

要将按钮用于Swiper,您需要在mySwiper对象上使用.swipeNext()和.swipePrev()方法,例如:

<!-- Add somewhere in HTML your buttons:-->
<span class="button-next">Next button</span>
<span class="button-prev">Previous button</span>
<script>
$(function(){
  var mySwiper = $('.swiper-container').swiper();
  //"Next" button - some HTML element with "button-next" class
  $('.button-next').click(function(){mySwiper.swipeNext()})
  //"Prev" button - some HTML element with "button-prev" class
  $('.button-prev').click(function(){mySwiper.swipePrev()})

})
</script>

关于javascript - iDangerous刷卡器未检测到刷卡,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16043055/

10-09 23:11