Twitter Stock Ticker
Last night I was rummaging through some of my past projects doing a little winter cleaning, and I stumbled upon this jQuery plugin that I wrote a while back. I ran the code to see if it still functions (it was using jQuery 1.3). And to my pleasant surprise, the code still runs like a charm. So, I just want to take the time to share it with you all.
This jQuery plugin is a Twitter stock ticker; the stock ticker one sees on Wall Street. And this is an example HTML page that uses the plugin:
<html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"></script> <script type="text/javascript" src="tweetstockticker.js"></script> <script> $(document).ready(function() { $('#tweet-container').tweetstocktick('san francisco', 5, 15); }); </script> <style> #tweet-container { overflow: hidden; position: relative; width: 100%; height: 100px; } #rotating-ticker-item { font-size: 36px; position: absolute; text-transform: uppercase; white-space:nowrap; width: auto; } </style> </head> <body> <div id="tweet-container"></div> </body> </html>
It’s a pretty simple implementation using the Twitter Search API
.tweetstocktick(q, rpp, speed)
q = search term (ie. “San Francisco”)
rpp = number of the most recent tweets
speed = used to calculate duration (speed * width).
Feel free to share any thoughts, and I hope it helps.
2 Comments