Info
Display Twitter updates from a user in a DOM element. Options for displaying friends' updates and filtering (e.g. for hashtags).
Usage
$("#container").jTwit(
{
username: 'chrisscott',
updatefrequency: 60000,
showfriends: false,
sizetofit: false,
filterexpression: /\#myhashtag/i,
maxtweets: 10
}
);This adds tweets to the element w/the ID container
Demo
demo (pass in ?=username where username is a username to display tweets for--otherwise will use mine)
Download
Options
- username: The Twitter username to display tweets from.
- updatefrequency: Number of milliseconds to wait between checking for new tweets. Defaults to 60000 (60 seconds). Due to Twitter API limitations, only 70 requests a minute can be made so keep this in mind when adjusting this.
- showfriends: Show the user's Friends updates as well. Defaults to false.
- sizetofit: When the window is loaded or resized, hide any tweets that are outside the window. Useful for kiosk/presentation/fullscreen modes. Only useful when using the multi-column CSS. Defaults to false. NOTE: this relies on the Dimensions Plugin
- filterexpression: A JavaScript regex (NOTE: not a string, see example above) to filter on. If set, only tweets that match the expression will be shown. Defaults to no filtering.
- maxtweets: The maximum number of tweets to show. Defaults to 20 and due to Twitter API limitations will not show more than 20 even if set higher.
Public Methods
- stop() Stop automatic refreshing.
- start() Start automatic refreshing.
- sizetofit() Size to fit window. Useful for doing so when sizetofit option is set to false.
CSS Classes
Each element added has a CSS class to give you control over the layout and look. Included in the source are a single-column and multi-column stylesheets. The following CSS classes are used:
- jtwit-tweet The DIV containing a single tweet's data.
- jtwit-tweet-text The DIV containing the text of a tweet.
- jtwit-tweet-image-container The DIV containing the user's image.
- jtwit-tweet-image The IMG of the user's image.
- jtwit-tweet-date The DIV containing the date of a tweet.
- jtwit-tweet-latest Added to the jtwit-tweet container DIV for the latest tweet.