function run_battle() {
if(battlenow.length>0) {
var div = document.getElementById('show_battle');
$("#show_battle").animate({ scrollTop: $("#show_battle").prop("scrollHeight") - $('#show_battle').height() }, 100);
var attempt = battlenow.shift();
div.innerHTML += attempt;
$("#show_battle").animate({ scrollTop: $("#show_battle").prop("scrollHeight") - $('#show_battle').height() }, 100);
setTimeout("run_battle()",800);
}
}
これは私がこれまでに持っているものです。それはfirefoxでうまく機能します。しかし、Chrome ではまったく機能しません。私は Jquery 1.7.1 を使用しています。そのため、.attr の代わりに .prop を使用しています。
バトルナウの配列はこんな感じ。
battlenow.push('Alan hit Joe<br><br>');
battlenow.push('Joe fainted<br><br>Battle Over');
それが役に立ったら。
ありがとうございました。