【问题标题】:Use Bootstrap Carousel for latest-tweets-php-o-auth使用 Bootstrap Carousel 获取 latest-tweets-php-oauth
【发布时间】:2013-08-29 10:20:22
【问题描述】:

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,它需要第一个“活动”类...

你会怎么做?

【问题讨论】:

    标签: twitter-bootstrap oauth carousel tweets


    【解决方案1】:

    修改参数以包括轮播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>
    

    【讨论】:

      猜你喜欢
      • 2019-07-06
      • 2015-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-13
      • 1970-01-01
      相关资源
      最近更新 更多