我试图让这个文字淡出旧文本并淡入新文本

时间:2017-02-24 04:00:27

标签: javascript jquery html web fadein

我试图让文字淡出,但在新文本发生变化后再回来。我想知道在我的代码中出现文本的地方可能有什么问题,然后淡出,然后以某种丑陋的方式回来......我怎么能修改这段代码?谢谢。

您可以在http://revolthub.com

查看我正在处理的网站
<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>

0 个答案:

没有答案