help with Remy Sharp's JQuery Marquee Plugin
I am trying to implement a solution so show the latest tweets for a certain hashtag.
I took inspiration from this http://exscale.se/__files/uploads/scrolling-twitter-feed.htm
but it uses the actual user's timelines and not the search api.
Plugin demo page here: http://remysharp.com/demo/marquee.html
So far I have written this but the text remains stationary:
JQuery:
$(document).ready(function(){
var url='http://search.twitter.com/search.json?q=';
var query='%23MYHASHTAG';
var options='&result_type=recent&rpp=1&page=1&callback=?';
$(".results").append('<marquee behavior="scroll" scrollamount="1" direction="left">');
$.getJSON(url+query+options,function(json){
$.each(json.results,function(i,tweet){
$(".results").append('<p><img src="'+tweet.profile_image_url+'" width="26" height="26" />'+tweet.from_user+': '+tweet.text+'</p>');
});
$(".results").append('</marquee>');
});
});
$('div.results marquee').marquee();
</script>
HTML:
<div class="results"></div>
I am at开发者_开发问答 a loss as to why this isn't working - there are no errors on the firebug console.
Any ideas?
Managed to get it by doing the following:
$(document).ready(function(){
var url='http://search.twitter.com/search.json?q=';
var query='%23HASHTAG';
var options='&result_type=recent&rpp=1&page=1&callback=?';
var html='<marquee behavior="scroll" scrollamount="1" direction="left">';
$.getJSON(url+query+options,function(json){
$.each(json.results,function(i,tweet){
html+='<p><img src="'+tweet.profile_image_url+'" width="26" height="26" />'+tweet.from_user+': '+tweet.text+'</p>';
});
html += '</marquee>';
$(".results").append(html);
$('div.results marquee').marquee();
});
});
精彩评论