2011-05-20 71 views
2

我需要找到一个jQuery-UI小部件/控件来做类似于Twitter UI的更新。我的意思是,当Twit进来时,它取代了列表中的操作,在浏览器UI中向下推动其他人。有谁知道这样的小部件或失败,如何在Javascript中做到这一点?jQuery-UI小部件/控件做Twitter更新的UI?

谢谢

回答

2

它在jQuery的简单...

HTML

<div id="tweets"> 
    <div>Tweet 1</div> 
    <div>Tweet 2</div> 
</div> 

的JavaScript

$(function() { 
    //Get new tweet however 
    var newtweet = "New Tweet" 

    $("<div>"+newtweet+"</div>").prependTo("#tweets").hide().slideDown(200); 
}); 
2

确切的功能是真的取决于你。没有什么理由使用任何类型的插件,因为做基本设置非常简单。

function addItem(title, text) 
{ 
    var pHTML = ['<div class="container">', 
        '<div class="title">', 
         title, 
        '</div><div class="description">', 
         text, 
        '</div></div>'].join(''); 
    // You'd do any animates here. 
    // You could also drop the bottom item in the list here, if so desired. 
    $('#box-wrapper').prepend(pHTML); 
}