0
我正在做一個基本的jQuery滑塊的類。並想在5秒後自動播放下一張幻燈片,但尚未使用定時器之前,它沒有做我認爲應該做的事。它等待適當的時間間隔,然後繼續觸發回調函數。添加自動播放到基本的jQuery滑塊
//basic slider on click
$('.slider>ul>li').click(function()
{
$('.slider>ul>li').removeClass('current');
$(this).toggleClass('current');
right=$(this).index()*745;
$(this).parent('ul').parent('.slider').children('div').children('ul').animate({'right': right}, 1000, 'easeOutBack');
})
//attempt to use timer plugin to auto play
$('.slider>ul>li').timer(
{
delay: 1000,
callback: function()
{alert($('.slider>ul>li.current').index())
if($('.slider>ul>li.current').index()!=3)
{
$('.slider>ul>li.current').next('li').click();
}else//oddly this doesn't trigger at all
{
$('.slider>ul').first().click();
}
}
})
您的快訊顯示什麼號碼? – Marc
0,1,2,3按順序 – Yamiko
http://ocd.classelliott.com/#是我在課堂上實施的可怕網站。 – Yamiko