I am using a jQuery script that shows a random slogan from an array on page load.
However I want this slogan to be changed every 6 sec. How can I do this?
This is a working fiddle and here is the code:
$(document).ready(function () {
phrases = [
"a creative Chicago design shop",
"design is simple",
"we build fine, fine things",
"we love creating"
];
var phrase = phrases[Math.floor(Math.random()*phrases.length)]
$('#site').text(phrase);
});
Fiddle!
Update: Thrown in a two-liner that prevents repetition of the same phrase two times in a row for good measure.