Return to Snippet

Revision: 42526
at March 6, 2011 10:40 by crypticsoft


Initial Code
function getTwitter(){

	var panel = $('#twitter_feed');
	var tweet = '';
	
if( panel.length > 0 ) {

 $.ajax({
    type : 'GET',
    dataType : 'jsonp',
    url : 'http://search.twitter.com/search.json?q=USERNAME',

    success : function(tweets) {

	$.each(tweets.results, function(i) {

		var created = tweets.results[i].created_at;
		var text = tweets.results[i].text;
		var href = 'http://twitter.com/USERNAME/status/'+tweets.results[i].id;
		var img = tweets.results[i].profile_image_url;

		tweet = '<span class="tweet"><img src="' + img + '" /><a href="' + href + '" rel="nofollow">' + text.substr(0, 45) + '..</a></span>';
		panel.append(tweet);
	    
	});
			//let's do fade in effect	
			$('#twitter_feed').cycle({ 
			    fx:      'scrollDown', 
			    speedIn:  2000, 
			    speedOut: 500, 
			    easeIn:  'easeOutBounce', 
			    easeOut: 'easeInBack', 
			    delay:   7000 
			});
    }//end each
 });//end ajax
}//end if

}

Initial URL

                                

Initial Description
Note: replace "USERNAME" with your own twitter username.
This is using cycle plugin with easing which is applied after the tweets are populated.

Initial Title
get twitter feed using json / jquery

Initial Tags
json, twitter

Initial Language
JavaScript