I recently created a custom ping box (chat). I have a auto refresh every 3 seconds to get the latest content.
If the user is busy anywhere other than the chat tab, I would like the latest chat pings to be highlighted in some different color.
This would allow the user to easily identify the latest pings that came in when they weren't on the tab. The color then fades automatically after 10 sec of coming into the chat tab.
Code to refresh new content:
function loadNewPosts(){
var id = $(".altbgcolor:first").attr("id");
$.post('/updateping.php', { updateid: id }, function(data){
$(".newslist").prepend(data);
//alert(data);
}, 'html');
}
window.setInterval(loadNewPosts, 1000*3)
Is it possible to code this using PHP and/or jQuery?