我试图让文字淡出,但在新文本发生变化后再回来。我想知道在我的代码中出现文本的地方可能有什么问题,然后淡出,然后以某种丑陋的方式回来......我怎么能修改这段代码?谢谢。
查看我正在处理的网站<script type="text/javascript">
var text = ['Sometimes you just have to destroy everything in order to build something brand new<span class="period">.</span>', 'So, we decided to destroy the old way of doing things, and completely redesign Revolt<span class="period">.</span>'];
var counter = 0;
var elem = document.getElementById("changeText");
setInterval(change, 8000);
$(elem).fadeIn();
function change(){
$(elem).fadeOut();
elem.innerHTML= text[counter];
counter++;
if(counter >= text.length) { counter = 0; }
$(elem).fadeIn();
}
</script>