I apologize if this question is fuzzy, but I want to create a drop-down header, very similar to the one found on StackOverflow, which alerts you when you earn a new icon, or on Twitter whenever a new tweet appears.
I searched the textbook on the Internet, but I have problems finding on the Internet exactly what I am looking for. I guess there is a way to do this in jQuery, or there might be a jQuery plugin for it, but I was not lucky to find it.
The idea would probably be to make an AJAX request every so many seconds, and if a new item worthy of attention is found, display it for the user.
If someone can point me to a resource to find out how to build it and / or an existing plugin, that would be great.
EDIT: If anyone is interested in how I made the actual header using jQuery,
In the success callback function of your ajax:
$("#alertHeader").html("whatever you want to say"); $("#alertHeader").slideDown("slow");
Where "alertHeader" is the identifier of your alert div.
Appropriate CSS for the header:
#alertHeader { position:relative; background:#313115; width:100%; height:30px; display:none; float:left; position:relative; z-index:10; } #alertText { padding-top: 2px; margin-left:auto; margin-right:auto; color: #FFF; font-size: 15px; font-style: italic; text-align: center; }
javascript jquery ajax
Zachary wright
source share