0

Andrew Biggart 的 latest-tweets-php-o-auth 是迄今为止最好的 Twitter 工具之一,我将使用 Bootstrap Carousel 显示推文:

这里是 latest-tweets-php-o-auth 函数:

function display_latest_tweets(

        // Function parameters.

        $tweet_wrap_open     = '<li class="item"><p class="home-tweet-tweet">',

在哪里:

// Render the tweet.
                            $twitter_html .= $tweet_wrap_open.html_entity_decode($tweet_desc).$meta_wrap_open.'<a href="http://twitter.com/'.$twitter_user_id.'">'.$display_time.'</a>'.$meta_wrap_close.$tweet_wrap_close;

假设我将有多个 li.item (推文),为了使用 Bootstrap Carousel 它需要第一个类“活动”......

你会怎么做?

4

1 回答 1

0

修改参数以包含轮播 id 和类:

// Function parameters.

$twitter_wrap_open   = '<div id="tweet" class="carousel slide"><div class="carousel-inner home-tweets-ul">',
$twitter_wrap_close  = '</div></div>',

在末尾/页脚中使用 jQuery 将活动类添加到项目中:

<script>
   jQuery(document).ready(function() {
        jQuery("#tweet .item:first").addClass("active");
        jQuery('#tweet').carousel({
            interval: 5000
        });
    });
</script>
于 2014-06-05T09:15:43.703 回答