I'm putting together an extremely basic script to display messages in a non-profit's reception - all it has to do is iterate through a list of messages, displaying each one for 11 seconds and fade them in and out.
So basically:
message fades in
Welcome! Will be with you shortly
11 second pause
message fades out
message fades in
Keep watching this screen for our latest news and initiatives
11 second pause
message fades out
an so on and so forth. What I have at the moment is this (plagiarised from Displaying array contents on page with a loop in jquery):
var Messages = [
"TEST 1",
"TEST 2",
"TEST 3",
"TEST 4",
];
function DisplayMessages() {
var Div = $("#content");
var startMessage = 0;
setInterval(function() {
Div.html(Messages[startMessage]).fadeIn().delay(11000).fadeOut();
startMessage++;
if(startMessage % Messages.length == 0) {
startMessage = 0;
}
}, 11000)
}
// run it
DisplayMessages();
</script>
Embarrassingly enough I can't figure out how to fix the timing so that each message fades in and out and displays for 11 seconds in-between. Any help would be appreciated.