-3

我的代码在这里检查我的图像表上是否有新帖子。

当我有一个新帖子并且我的时间戳发生变化时,我希望一个 div 向下滑动,说有新的更新,如下图所示:

Instagram:1 张新照片

setInterval('checkForUpdates', 30000);
var lastTime = (new Date()).getTime();
function checkForUpdates() {
   $.get('image.php?timestamp=' . lastTime
      , function (results) {
         if (results) { /* fade into dom */ }
      }
   );
   lastTime = (new Date()).getTime();
}
4

2 回答 2

0
//add the div with the new post text
$("the conatiner id").prepend("<div class = 'new-post' style = 'width: 100%; height = 20px;'> A new post has been added </div>");
//make it slide down
$("the container id").find(".new-post:last").slideDown("fast");
于 2013-03-18T00:56:27.967 回答
0

您是否尝试过使用滑下功能?http://api.jquery.com/slideDown/ 或从 0 开始动画高度 jQuery 动画高度

于 2013-03-18T00:49:28.017 回答