我在我的网站上创建了一个即时的推特信息,这是一个用旋转木马包裹的需求。我面临的挑战是将twitter提要div转换为" li 's“,这样每个twitter提要都显示在一个独立的li中。
单击此处
我一直在这样做,阅读下面的内容;
http://api.jquery.com/wrap/
然而,我发现它很难消化。在这个论坛上,有没有人能善意地分解发展进程以实现这一点?
谢谢
发布于 2012-03-02 12:32:22
我帮你解决了另一个问题,所以我假设你想把这个应用到同一个url - 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>');分类了!
https://stackoverflow.com/questions/9516389
复制相似问题