I'm prepending the name, tweet and timestamp as a row into an existing HTML table. I'm using codebird-js to get the tweets. My existing code simply prepends the new tweets into the table. But I want to add a slow slidedown animation to the new table rows when they get prepended at the top. The aim is to give an impression to the viewer that the existing rows are pushed down to make room for the new rows. So far been unable to do that. Any help will be appreciated. Thanks in advance.
Here is the HTML
<input type="text" id="tweet-form" placeholder="search text...">
<button id="tweet-button" onclick="showTweets();">Get Tweets</button>
<div id="tweet-rows">
<table></table>
</div>
The CSS
#tweet-rows {
display: none;
}
JavaScript
function showTweets() {
var tweetText = $('#tweet-form').val();
console.log(tweetText);
var cb = new Codebird;
cb.setConsumerKey(
"CONSUMER_KEY",
"CONSUMER_SECRET"
);
cb.setToken(
"ACCESS_TOKEN",
"ACCESS_TOKEN_SECRET"
);
cb.__call(
"search_tweets", {
q : tweetText,
},
function (reply) {
for(var i=reply.statuses.length-1; i>=0; i--) {
var name = reply.statuses[i].user.name;
var tweet = reply.statuses[i].text;
var timestamp = reply.statuses[i].created_at;
$('#tweet-rows > table').prepend('<tr><td>@' + name + '</td><td>' + tweet + '</td><td>' + timestamp + '</td></tr>');
//console.log('@' + name + ' : ' + tweet + ' ' + timestamp);
}
$('#tweet-rows').show();
}, true
);
}
I've cooked up this fiddle where I've tried to demonstrate the problem.