jQuery Twitter Ticker
- Scrolling always moves “downward” even when actually wrapping back to the top of the tweet list
- A tweet’s relative timestamp (“15 minutes ago,” etc.) is updated each time it is moved into view
- Scrolling is paused when the user mouses over the ticker, to keep links from moving out from under the cursor
- When new tweets are fetched and prepended to the list, they are immediately brought into view on next scroll
- Include jQuery in whichever fashion you like. I like to use Google’s CDN.
- Create an element on your page to contain the Twitter feed and invoke
$.twitterTickeron it. Pass an options hash for configuration.
- screen_name (required) What user’s tweets should be shown?
- items (optional) Cycle through how many tweets (default 10)?
- rotate (optional) How long should each tweet remain in view (in seconds; default 5)?
- update (optional) Check Twitter for new tweets how frequently (in seconds; default 0, meaning no checks)? Note that Twitter’s API limits an IP to 150 requests/hour, which works out to 24 seconds between requests.
Suppose a DIV with ID “twitter” is put on the page and this plugin is run on it. The original element gets class “twitter-ticker” applied to it, and the following markup is generated inside by the plugin, once tweets have been retrieved from Twitter:
div.scroll ul li li li …
- Option to prepend Twitter screen name and/or avatar
- Allow cycling through a Twitter search query rather than a single user’s tweet list