我會targetin
和targetout
事件偵聽器做到這一點。文檔的jCarousel事件:http://sorgalla.com/jcarousel/docs/reference/events.html
您也可以嘗試visiblein
和visibleout
示例設置,如果你有每張幻燈片中的文本元素:
$('.jcarousel')
.on('jcarousel:targetin', 'li', function() {
// "this" refers to the item element
// "carousel" is the jCarousel instance
var $slide = $(this);
$slide.removeClass('active-slide');
//sudo code, but put animations here
$slide.find('.text-effect-element').animate();
})
.on('jcarousel:targetout', 'li', function() {
// "this" refers to the item element
// "carousel" is the jCarousel instance
var $slide = $(this);
$slide.removeClass('active-slide');
//sudo code, but put animations here
$slide.find('.text-effect-element').animate();
});
你也可以使用CSS動畫依賴於類的父幻燈片。