-1
我對JavaScript相當陌生,但在整個前端開發方面有過先前的經驗。我試圖讓JS遍歷提供的列表並在我的網站上顯示結果。每個項目將顯示一次,然後移至列表中的下一個項目。到達最後時,最後一個項目將被永久顯示。我正在使用Textillate JS庫。我提供的JavaScript有什麼特別的錯誤?
我的代碼有什麼問題?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
var title-transitions = [
"Create Solutions",
"Build Relationships",
"Design Brands",
"Redifine Excellence"
],
transitionCounter = 0,
looped = false,
textillateSettings ={
loop:false,
in:{
callback:fucntion(){
if(!looped) $('h1.introduction-heading').fadeOut(3800);
}
}
};
var $h1 = $('h1.introduction-heading');
$h1.introduction-heading(textillateSettings);
var animationHero = set Interval(function(){
transitionCounter =
(transitionCounter == transition.legnth -1)
? 0 : transitionCounter + 1;
if(transitionCounter == 0){
looped = true;
clearInterval(animatedHero);
}
$('h1.introduction-heading').remove();
$('h1.introduction-heading')
.text(transition[transitionCounter])
.textillate(textillateSettings);
}, 6000);
</script>
這裏是textillate site的網址,如果它可以有任何幫助的話。
如何縮進? – DavidG
打開瀏覽器的JavaScript控制檯。你會在那裏看到錯誤消息。你有一些語法錯誤。 – JJJ
JavaScript變量名稱中不允許使用[Dashes](http://stackoverflow.com/questions/5516106/are-dashes-allowed-in-javascript-variable-names)。 – showdev