我正在使用 Orbit 滑块,在每个幻灯片动画之后,您可以运行一个函数。
我有四个包含内容的类,并希望将它们全部隐藏在第一个 div 中,然后在第一个动画之后淡入/淡出以显示第二个,依此类推,直到幻灯片结束,它在哪里循环回到开头,因此内容与滑块保持同步。
HTML 标记:
<div class="contentSlider">Content for slider 1</div>
<div class="contentSlider">Content for slider 2</div>
<div class="contentSlider">Content for slider 3</div>
<div class="contentSlider">Content for slider 4</div>
Orbit 插件脚本是:
<script type="text/javascript">
$(window).load(function() {
$('#featured').orbit({
animation: 'horizontal-push', // fade, horizontal-slide, vertical-slide, horizontal-push
animationSpeed: 800, // how fast animtions are
timer: true, // true or false to have the timer
advanceSpeed: 10000, // if timer is enabled, time between transitions
pauseOnHover: false, // if you hover pauses the slider
directionalNav: true, // manual advancing directional navs
captions: false, // do you want captions?
captionAnimation: 'fade', // fade, slideOpen, none
captionAnimationSpeed: 800, // if so how quickly should they animate in
bullets: true, // true or false to activate the bullet navigation
bulletThumbLocation: '', // location from this file where thumbs will be
afterSlideChange: function(){
// function to keep the content below the slider in sync with the slider.
}
});
});
</script>