如何使用Jquery获得推文? [英] How can I get tweets using Jquery?

查看:87
本文介绍了如何使用Jquery获得推文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Jquery显示来自Twitter的新推文.

I need to display new tweets from Twitter using Jquery.

推荐答案

jquery.tweet.js 是优秀的插件使用.

jquery.tweet.js is an excellent plugin to use.

安装和运行起来非常简单,只需下载相关文件,然后将以下内容添加到html中(当然,最好将js与外部文件放在一起!)

It is really simple to get up and running, just download the associated files and add the following to your html (with the js ideally in an external file of course!)


<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>

它带有一些预定义的样式,但是很容易添加您自己的样式.

It comes with some predefined styles but is easy enough to add your own styles.

html输出是一个无序列表,具有偶数和奇数项的不同类别,例如:

The html output is an unordered list with different classes for even and odd items, for example:


<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>

这篇关于如何使用Jquery获得推文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆