2015-02-06 92 views
0

我有一個iosSlider v1.3.43(06/17/2014),我想使用.iosSlider('prevPage')和.iosSlider('nextPage')方法,但我無法設法使用這些方法。我認爲這很簡單,但我無法實現它的工作。jQuery iosslider頁面滾動

我閱讀以下文章(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'); 

回答

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')}); 

好運〜

+0

請添加一些解釋和格式化你的代碼。解釋爲什麼你的代碼應該工作。 – Nilambar 2015-07-27 04:23:57