0
我工作的一個項目,我這個問題..戰鬥如何使這個滑塊去自動播放?
我想魔劍這個滑塊去自動播放
<script type="text/javascript">
$(document).ready(function() {
var showCaseItems = $('.show-case-item').hide();
var splashes = $('.splash').hide();
//get each image for each slide and set it as a background of the slide
// splashes.each(function() {
// var img = $(this).find('img');
// var imgSrc = img.attr('src');
// img.css('visibility', 'hidden');
// $(this).css({ 'background-image': 'url(' + imgSrc + ')', 'background-repeat': 'no-repeat' });
// });
splashes.eq(0).show();
showCaseItems.eq(0).show();
var prevIndex = -1;
var nextIndex = 0;
var currentIndex = 0;
$('#banner-pagination li a').click(function() {
nextIndex = parseInt($(this).attr('rel'));
if (nextIndex != currentIndex) {
$('#banner-pagination li a').html('<img src="<?php bloginfo('template_url'); ?>/assets/img/slidedot.png" alt="slide"/>');
$(this).html('<img src="<?php bloginfo('template_url'); ?>/assets/img/slidedot-active.png" alt="slide"/>');
currentIndex = nextIndex;
if (prevIndex < 0) prevIndex = 0;
splashes.eq(prevIndex).css({ opacity: 1 }).animate({ opacity: 0 }, 500, function() {
$(this).hide();
});
splashes.eq(nextIndex).show().css({ opacity: 0 }).animate({ opacity: 1 }, 500, function() { });
showCaseItems.eq(prevIndex).css({ opacity: 1 }).animate({ opacity: 0 }, 500, function() {
$(this).hide();
showCaseItems.eq(nextIndex).show().css({ opacity: 0 }).animate({ opacity: 1 }, 200, function() { });
});
prevIndex = nextIndex;
}
的setTimeout(函數(){$('#橫幅分頁麗a')。trigger('click');},1500); < - 這dindt讓它去autplay onload事件,但經過「點擊」
return false;
});
});
</script>
現在,您可以通過單擊單選按鈕來瀏覽幻燈片。 – Giovanni