6 divをフェードインしてから、5秒間フェードアウトさせようとしています。Div1は最初にonClickを表示し、次に5秒間続き、次にフェードアウトし、次のオンがポップアップしてからフェードアウトします。私はこのJavaScriptで遊んでいますが、問題があります-1)ボタンがクリックされたときにJavaScriptを呼び出す、2)1秒のオーバーラップを可能にするコードを作成するにはどうすればよいですか?
何か助けはありますか?これが私のJavaScriptです:
$(function () {
var counter = 0,
divs = $('#tutorial1, #tutorial2, #tutorial3, #tutorial4, #tutorial5, #tutorial6');
function showDiv () {
divs.hide() // hide all divs
.filter(function (index) { return index == counter % 3; }) // figure out correct div to show
.show('fast'); // and show it
counter++;
}; // function to loop through divs and show correct div
showDiv(); // show first div
setInterval(function () {
showDiv(); // show next div
}, 5 * 1000); // do this every 5 seconds
});