テキストのブロックを自動的に「入力」するjQueryプログラムを作成しています。ユーザーが「テキストをクリアして機能を再開する」機能を再開できるようにしようとしています。これを行う方法がわかりません。コードは次のとおりです。
var char = 0;
var caption = "";
var standby
// initiate the Cursor
$(document).ready(function() {
setInterval ( "cursorAnimation()", 600);
});
// initiate the Text
$(document).ready(function() {
$('#abouttext').aboutText();
});
// The typing animation
function aboutText() {
$('#abouttext').html(caption.substr(0, captionLength++));
if(captionLength < caption.length+1){
setTimeout("type()",50);
}else{
captionLength = 0;
caption = "";
}
}
// The Restart Button
function restart() {
$('#restartbtn').click(function () {
var typing = $('#abouttext');
}
typing.stop();
// The cursor animation
function cursorAnimation() {
$('.cursor').animate({
opacity : 0
}, "fast", "swing").animate({
opacity : 1
}, "fast", "swing");
}
stop()で関数を停止する必要があると思います。その後、すべてを再起動します。しかし、どうすればいいのかわかりません。どんな助けでも素晴らしいでしょう。-ありがとう!