【问题标题】:jQuery swipe on mobile using anoSlide使用 anoSlide 在移动设备上滑动 jQuery
【发布时间】:2015-04-11 14:38:12
【问题描述】:

如何让幻灯片在移动设备上滑动?

我正在使用 anoSlide:http://www.anowave.com/factory/anoslide/demo.html

这是触发滑块 next 和 prev 的代码:

$('.carousel ul').anoSlide(
{
    items: 1,
    speed: 500,
    prev: 'a.prev',
    next: 'a.next',
    lazy: true,
    auto: 4000
})

向左或向右滑动时是否可以触发下一个、上一个按钮?

到目前为止,我有这个,但它不起作用:

$('.carousel-contentList').on("swiperight",function(){
    $(this).anoSlide({next: next});
});

$('.carousel-contentList').on("swipeleft",function(){
    $(this).anoSlide({prev: prev});
});

【问题讨论】:

    标签: javascript jquery jquery-mobile


    【解决方案1】:

    next 和 prev 属性用于关联 DOM 元素,如按钮。它们不是更改当前幻灯片的方法。而不是在滑动时,您可以触发上一个和下一个按钮的点击事件:

    $('.carousel').on("swiperight",function(){
        $('a.prev').click();
    });
    
    $('.carousel').on("swipeleft",function(){
        $('a.next').click();
    });
    

    DEMO

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多