【问题标题】:twitter widget wrap issuetwitter小部件包装问题
【发布时间】:2012-03-02 20:32:22
【问题描述】:

我在我的网站上创建了一个实时推文提要,希望将其包装在轮播中。我面临的挑战是将 twitter API 提要 div 转换为“li”,因此每个 twitter 提要都显示在单独的 li 中。

click here

我一直在阅读以下内容;

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

但是我发现它很难消化。这个论坛里有没有人可以很好地分解开发过程来实现这一点?

谢谢

【问题讨论】:

  • 您是否使用搜索 API 来检索这些推文?
  • hmm,我制作了一个滚动 twitter 小部件,它使用搜索 api 获取推文,我认为有一个插件可用于您正在尝试做的事情,因为我记得找到它,但因为它没有t 使用我无法使用的搜索 api/将其转换为我需要的。我现在去看看
  • 你发给我的那个链接,不是我想要达到的。

标签: javascript jquery css twitter jcarousel


【解决方案1】:

我帮助解决了你的另一个问题,所以我假设你想将它应用到同一个 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>');

排序!

【讨论】:

    猜你喜欢
    • 2011-03-11
    • 2011-08-18
    • 2015-06-23
    • 2011-04-10
    • 2013-08-13
    • 2021-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多