简体   繁体   中英

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/

Thanks

If you change your code to -

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

And your external reference in jsfiddle to -

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

Then it should work.

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

You can use another jquery twitter plugin

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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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