如何用 Ajax 弹出警报?

我希望做一些类似Stackoverlow的功能,向用户展示重要的信息:比如2个新答案和1个新注释,这些都将显示在屏幕顶部的一个橙色div中,作为一种警告,并在其上有一个X来关闭窗口。我想使用jQuery来做这件事,因为这是我选择的库。有什么教程或代码样本可以寄给我吗?谢谢!

For this, you'll want to combine two concepts:

The first is having a div that shows at the top of the page. Take a look at this tutorial, which shows you how to place <div>s over top of each other. Essentially, you'll want your info bar placed at the top with a z-order of something larget than everything else in the same spot.

Once you have it where you want it, you'll then need to fade it in or out. This article will show you what is required to fade in/out divs using javascript.

Just set the area's opacity to 100% and fade it in when the page loads. Then have a link or button that calls the javascript to fade out if you want to close it (or do it after a certain time).