jQuery iosslider页面滚动

时间:2015-02-06 10:55:47

标签: jquery slider

我有一个iosSlider v1.3.43(06/17/2014),我想使用.iosSlider('prevPage')和.iosSlider('nextPage')方法,但我无法使用这些方法。我觉得这很简单,但我无法让它发挥作用。

我阅读了以下帖子(https://stackoverflow.com/questions/23892753/jquery-iosslider-number-of-slides-per-scroll)并尝试了onClick方法,但仍然没有。

以下是我的代码:

jQuery('#homefeatured .newproducts .carousel').iosSlider({
    desktopClickDrag: true,
    snapToChildren: true,
    infiniteSlider: true,
    navNextSelector: '#homefeatured .new-arrow.next',
    navPrevSelector: '#homefeatured .new-arrow.prev',
    lastSlideOffset: 3,

    onFirstSlideComplete: function(){
        jQuery('#homefeatured .new-arrow.prev').addClass('disabled');
    },
    onLastSlideComplete: function(){
        jQuery('#homefeatured .new-arrow.next').addClass('disabled');
    },
    onSlideChange: function(){
        jQuery('#homefeatured .new-arrow.next').removeClass('disabled');
    },
});

jQuery('#homefeatured .new-arrow.prev').iosSlider('prevPage');
jQuery('#homefeatured .new-arrow.next').iosSlider('nextPage');

1 个答案:

答案 0 :(得分:0)

我认为你错过了事件绑定代码。

见下文..

jQuery('#homefeatured .new-arrow.prev').bind('click',function(){jQuery('#homefeatured .newproducts .carousel').iosSlider('prevPage')});
jQuery('#homefeatured .new-arrow.next').bind('click',function(){jQuery('#homefeatured .newproducts .carousel').iosSlider('nextPage')});
祝你好运〜