【发布时间】:2016-06-08 16:46:54
【问题描述】:
我需要你的帮助一次,猫头鹰旋转木马最古老的版本。目前我需要设置一个 stopOnHover 功能。当您将鼠标悬停在它停止的滑块上时,会出现原始选项。我在滑块中有一个按钮,需要修改功能以仅在将鼠标悬停在按钮上时停止滑块。
这是我的配置。
$(document).ready(function() {
$(".owl-carousel").owlCarousel({
loop:false,
navigation : true,
pagination : true,
paginationSpeed : 1000,
singleItem: true,
transitionStyle: "mask",
autoHeight: true,
autoPlay: 6000, //Set AutoPlay to 3 seconds
navigationText : false,
stopOnHover: true,
afterAction: syncPosition,
afterInit: function(){
$("#sequence-1").find('video').get(0).play();
}
});
function syncPosition(el){
var current = this.currentItem;
// code for smooth transition
this.owl.owlItems.removeClass('turn-on');
var t = this;
$(this.owl.owlItems[this.owl.currentItem]).addClass('turn-on');
}
});
$(window).scroll(function(){
if ($(this).scrollTop() > 80) {
$('.owl-pagination').addClass('hidden');
} else {
$('.owl-pagination').removeClass('hidden');
}
});
感谢您的帮助
编辑:
我在作者的网站上找到了一个函数(方法)owl.stop()。
尝试使用鼠标悬停但不起作用。
$(".slider_button").on("mouseover", function (){
owl.stop()
});
【问题讨论】:
标签: javascript html function hover owl-carousel