简体   繁体   English

我如何使用 jquery 将推文数量限制为一条

[英]how do i limit the number of tweets to one using jquery

i am trying to display just the most recent tweet on my home page i see a working example however it is not limited to one how do i make this return just one tweet?我试图在我的主页上显示最近的推文我看到了一个工作示例但是它不限于一个我如何让这个返回只有一个推文?

example: http://jsfiddle.net/pborreli/pJgyu/例如: http://jsfiddle.net/pborreli/pJgyu/

Thanks谢谢

If you change your code to -如果您将代码更改为 -

   $(function(){ 
    $('#tweets').tweet({
           count: 1,
           username: "jquery"
    });
   });

And your external reference in jsfiddle to -以及您在 jsfiddle 中的外部参考 -

http://tweet.seaofclouds.com/jquery.tweet.js http://tweet.seaofclouds.com/jquery.tweet.js

Then it should work.然后它应该工作。

http://jsfiddle.net/zSLWt/1/ http://jsfiddle.net/zSLWt/1/

You can use another jquery twitter plugin您可以使用另一个jquery twitter 插件

Steps:脚步:

Add a markup添加标记

<div id="twitter"> 
   results will be here
</div> 

Call plugin method like调用插件方法如

<script type="text/javascript"> 
        $(document).ready(function() {
            $("#twitter").getTwitter({
                userName: "jquery",
                numTweets: 5,
                loaderText: "Loading tweets...",
                slideIn: true,
                slideDuration: 750,
                showHeading: true,
                headingText: "Latest Tweets",
                showProfileLink: true,
                showTimestamp: true
            });
        });
    </script> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM