I have a Script which prints out a New Array Element every 6 Seconds. Now I want to add every Interval a Class (Css Animation) and remove it afterwards. So that every Number fades in (and out - that's in my css animation). I once tried to animate the whole h2#quotes - but it seems to get out of tact with script / css. Here is a live Example: http://quotes.sumisuweb.at/
var quoteIndex = 0;
var quoteJson = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
var setQuote = function() {
var quote = quoteJson[quoteIndex];
quoteIndex = (quoteIndex + 1) % quoteJson.length;
setTimeout(setQuote, 6000);
$("#quote").text(quote);
}
jQuery( document ).ready(function($) {
setQuote();
});
CSS:
#quote {
text-shadow: 0px 0px 13px white;
text-align: center;
margin-top: 100px;
font-size: 100pt;
}
.animateQuote {
animation-name: fadeIn;
animation-duration: 6s;
animation-timing-function: linear;
}
@keyframes fadeIn {
0% {opacity: 0.0;}
80% {opacity: 1.0;}
100% {opacity: 0.0;}
}