-3

I have my code here that checks if there is a new post on my image table.

When I have a new post and my timestamp changes, I want a div to slide down saying there are new updates, like in this picture:

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();
}
James M
  • 18,506
  • 3
  • 48
  • 56

2 Answers2

0

have you tried using the slide down function? http://api.jquery.com/slideDown/ or animate the height from 0 jQuery animate height

Community
  • 1
  • 1
user472749
  • 429
  • 1
  • 4
  • 13
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");
monkeyhouse
  • 2,875
  • 3
  • 27
  • 42