2016-07-22 68 views
0

我正在使用貓頭鷹旋轉木馬和同步滑塊。 我正在使用觸發owl-next函數的自定義導航。貓頭鷹旋轉木馬自定義導航觸發器父項事件

我的問題是,觸發底部幻燈片中的「下一張」幻燈片工作,但不是第二個按鈕,應該觸發父滑塊。

我迄今爲止代碼:

$(".konfig-slide-top").owlCarousel({ 
     navigation: false, 
     pagination: false, 
     slideSpeed: 1000, 
     paginationSpeed: 500, 
     paginationNumbers: false, 
     singleItem: true, 
     autoPlay: false, 
     autoHeight:false, 
     animateIn: 'slideIn', 
     animateOut: 'slideOut', 
     afterAction : syncPositionnew, 
     responsiveRefreshRate : 200, 
     afterMove: afterActionnew 
    }); 

var owl = $(".konfig-slide-inner"); 

    owl.owlCarousel({ 
     items: 1, 
     pagination: false, 
     navigation: false, 

     slideSpeed: 800, 
     paginationSpeed: 700, 
     animateIn: 'slideIn', 
     animateOut: 'slideOut', 
     autoHeight: true, 
     responsiveRefreshRate : 100, 
     mouseDrag: false, 
     loop: false, 
     afterInit : function(el){ 
     el.find(".owl-item").eq(0).addClass("syncednew2"); 
     } 
    }); 

//slide inner slider   
    $('.next-inner').click(function() { 
     owl.trigger('owl.next'); 
    }); 

    // slide parent slider 
    $('.next-top').click(function() { 
     var top = $(".konfig-slide-top").find('owl-controls'); 
     top.trigger('owl.next'); 
    }); 

父滑塊的其他可能的解決方案是:

var top = $(".konfig-slide-top"); 

    // slide parent slider 
    $('.next-top').click(function() { 
     top.trigger('owl.next'); 
    }); 

我好像錯過了什麼。有誰知道什麼?

回答

0

該解決方案非常簡單。那好像是這樣。

var top = $(".konfig-slide-top"); 

    // slide parent slider 
    $('.next-top').click(function() { 
     top.trigger('owl.next'); 
     return false; 
    }); 

Adding return false;使代碼正常工作。 但我不明白爲什麼。 :/有人可以解釋給我嗎?