I'm working on a small application that has a message window. The messages are stored in a db and updated by fetching 5 of the latest messages:
scienceTeamMessages = new Meteor.Collection('scienceTeamMessages');
Meteor.methods({
'sendMessageFromMS': function(message, destination) {
if (destination === "scienceTeam") {
scienceTeamMessages.insert({
message: message,
createdAt: new Date()
});
}
}
});
These messages are then iterated over in an html template:
{{#each messages}}
<li><h6>{{message}}</h6></li>
{{/each}}
What I would like, and I can't figure out how to do, is for the latest message to blink a few times, so as to draw attention from the user when a new message arrives. Like, fading in and out from black to red 3 times.
Any suggestions? I know how to do the css, but I am unsure about how to do it on changes to the database. That is why the other solutions on SO won't work in this specific question.