我使用的是带有同步滑块的猫头鹰旋转木马。我使用的是一个自定义导航,它触发了owl的下一个功能。
我的问题是,触发底部幻灯片中的"下一个"幻灯片是有效的,但第二个按钮不起作用,它应该触发父滑块。
到目前为止我的代码:
$(".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');
});
我好像错过了什么。有人知道吗?
解决方案非常简单。看来是这样。
var top = $(".konfig-slide-top");
// slide parent slider
$('.next-top').click(function() {
top.trigger('owl.next');
return false;
});
添加return false;使代码正常工作。但我不太明白为什么有人能向我解释一下吗?