2012-03-01 55 views
0

我已經創建了一個實時微博飼料到我的網站上,這是一個想要包裹在旋轉木馬上。我面臨的挑戰是將twitter API feed div轉換爲「li's」,這樣每個twitter feed都會以獨立的li顯示。微件裝飾問題

click here

我一直在這樣做讀成以下;

http://api.jquery.com/wrap/

但我發現很難消化。在這個論壇中有沒有人可以分解開發過程來實現這一目標?

感謝

+0

你使用搜索api來檢索這些推文嗎? – martincarlin87 2012-03-01 12:50:01

+0

我使用這個https://twitter.com/about/resources/widgets/widget_profile – 2012-03-01 12:52:16

+0

嗯,我做了一個滾動的twitter部件,使用搜索api獲取推文,我想有一個插件,正在嘗試做,因爲我記得找到它,但因爲它沒有使用搜索API,我無法使用/將其轉換爲我所需要的。我現在要看看它 – martincarlin87 2012-03-01 12:56:06

回答

0

我幫助了你的其他問題,以便即時通訊假設你想這適用於同一網址 - http://thisiswired.com/test/test.html

如果這是你可以使用下面的代碼的情況下:

// Remove unwanted div 
$('.twtr-reference-tweet').remove(); 

// Change the <div>s to <li>s 
$('.twtr-tweet').each(function() { 
    $(this).replaceWith('<li id="'+$(this).attr('id')+'" class="'+$(this).attr('class')+'">' + $(this).html() + '</li>'); 
}); 

// Change the parent <div> to <ul> and wrap it in a <div> ready to apply the carousel 
$('.twtr-tweets').replaceWith('<div id="carouselId"> <ul class="twtr-tweets">'+$('.twtr-tweets').html()+'</ul></div>'); 

排序!