2013-03-18 79 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");