2016-11-24 111 views
-6

有沒有一種方法,我可以很容易地實現與HTML這種類型的動畫文本的目標網頁上動畫文本着陸頁

Image

+0

也許是的,或與Jquery – Alexis

+0

此鏈接將幫助你http://codepen.io/hi-im-si/pen/DHoup –

回答

3

是的,有:)

var messages = ["Be", "Up to Speed", "Up to", "Up"], 
 
    counter = 0, 
 
    target = document.getElementById("message"); 
 

 
setInterval(function(){ 
 
    
 
    target.innerHTML = messages[counter]; 
 
    counter++; 
 
    
 
    if(counter >= messages.length) { 
 
    counter = 0; 
 
    } 
 

 
}, 300);
body { 
 
    font: bold 1em sans-serif; 
 
} 
 
#message { 
 
    box-shadow: .125em 0 0 0 rgba(128,128,128,.3); 
 
    color: MediumAquamarine; 
 
    padding-right: .125em; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 

 
<h1>You too can... <span id="message"></span></h1>