2013-03-18 41 views
-3

我有我的代码在这里检查我的图像表是否有新帖子。当更新时jQuery div向下滑动

当我有一个新的职位和我的时间戳的变化,我想一个div滑下说有新的更新, 像这样的画面:

Instagram: 1 new photo

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(); 
} 
+1

什么是你的问题的高度? – MattDiamant 2013-03-18 00:42:27

+0

我的问题是我如何滑动一个div当jquery检查我的image.php页面的时间戳!并有一个新的更新! – 2013-03-18 00:45:01

回答

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");