猫头鹰轮播幻灯片中的元素在动画开始之前显示(fadeInUp 和 zoomIn)。它们不应该在动画之前可见。在第一张幻灯片中,它们表现良好,但在第二张幻灯片中,您可以看到它们总是在 css 动画发生之前出现。
检查这个小提琴:https : //jsfiddle.net/6k8agot1/
//Start Hero slider initialize code
$(document).ready(function(){
var heroSlider = $('.owl-carousel');
heroSlider.owlCarousel({
animateOut: 'fadeOut',
animateIn: 'fadeIn',
autoplayTimeout:5000,
autoplayHoverPause: true,
loop: true,
margin: 0,
nav: false,
mouseDrag:false,
touchDrag:true,
pullDrag:false,
freeDrag:false,
dots:true,
autoplay:true,
responsive: {
0: {
items: 1
},
600: {
items: 1
},
1000: {
items: 1
}
}
});
// End Hero slider initialize code
// Start Reactivate css animation every time a slide is loaded
heroSlider.on("changed.owl.carousel", function(event){
// selecting the current active item
var item = event.item.index-2;
// first removing animation for all captions
$('h1, p').removeClass('fadeInUp');
$('a').removeClass('zoomIn');
$('.owl-item').not('.cloned').eq(item).find('h1, p').addClass(' fadeInUp');
$('.owl-item').not('.cloned').eq(item).find('a').addClass(' zoomIn');
})
});
呼唤远方
相关分类