3
我需要使用Jquery從Twitter顯示新的推文。如何使用jquery獲取推文?
我需要使用Jquery從Twitter顯示新的推文。如何使用jquery獲取推文?
jquery.tweet.js是一個很好的插件使用。
這是非常簡單的啓動和運行,只要下載相關文件,並添加以下到您的HTML(與JS最好的當然是一個外部文件!)
<script type='text/javascript'> $(document).ready(function(){ $(".tweet").tweet({ username: "seaofclouds", join_text: "auto", avatar_size: 32, count: 3, auto_join_text_default: "we said,", auto_join_text_ed: "we", auto_join_text_ing: "we were", auto_join_text_reply: "we replied to", auto_join_text_url: "we were checking out", loading_text: "loading tweets..." }); }); </script> <div class="tweet"></div>
它配備了一些預定義的樣式,但很容易添加自己的樣式。
的HTML輸出是一個無序列表與不同類的偶數和奇數項,例如:
<ul class="tweet_list"> <li class="tweet_first tweet_odd"> <span class="tweet_text">[Tweet text]</span> <span class="tweet_time">about 21 hours ago</span> </li> <li class="tweet_even"> <span class="tweet_text">[Tweet text]</span> <span class="tweet_time">about 22 hours ago</span> </li> </ul>