I'm trying to get this script to run, than end on the word Awesome. and then loop again/repeat.
Here's the JS
var i, word, rnd, words, fadeSpeed, timer;
words = ['respected.', 'essential.', 'tactical.', 'effortless.', 'credible.', 'smart.', 'engaging.', 'focused.', 'effective.', 'clear.', 'relevant.', 'strategic.', 'trusted.', 'compelling.', 'admired.', 'inspiring.', 'cogent.', 'impactful.', 'valued.'];
fadeSpeed = 500;
timer = 2000;
for (i = 0; i < 20; i++) {
if (i === 19) {
word = 'awesome.';
rnd = Math.floor(Math.random() * words.length);
word = words[rnd];
words.splice(rnd, 1);
} else {
rnd = Math.floor(Math.random() * words.length);
word = words[rnd];
words.splice(rnd, 1);
}
(function(word) {
$('h1.random em').fadeOut(fadeSpeed, function() {
$(this).html(word);
})
.slideDown('slow')
.delay(timer)
.fadeIn(fadeSpeed);
})(word);
}
Here's a link to the dev site.
Aucun commentaire:
Enregistrer un commentaire