Returned JSON from Twitter and displaying tweets using FlexSlider
Posted
by
Trey Copeland
on Stack Overflow
See other posts from Stack Overflow
or by Trey Copeland
Published on 2012-11-21T16:57:14Z
Indexed on
2012/11/21
16:59 UTC
Read the original article
Hit count: 347
jQuery
After sending a request to the Twitter API using geocode, I'm getting back a json response with a list of tweets. I then that into a php array using json_decode() and use a foreach loop to output what I need. I'm using flex slider to show the tweets in a vertical fashion after wrapping them in a list.
So what I want is for it to only show 10 tweets at a time and scroll through them infinitely like an escalator.
Here's my loop to output the tweets:
foreach ($tweets["results"] as $result) {
$str = preg_replace('/[^\00-\255]+/u', '', $result["text"]);
echo '<ul class="slides">';
echo '<li><a href="http://twitter.com/' . $result["from_user"] . '"><img src=' . $result["profile_image_url"] . '></a>' . $str . '</li><br /><br />';
echo '</ul>';
}
My jQuery looks like this as of right now as I'm trying to play around with things:
$(window).load(function() {
$('.flexslider').flexslider({
slideDirection: "vertical",
start: function(slider) {
//$('.flexslider .slides > li gt(10)').hide();
},
after: function(slider) {
// current.sl
}
});
});
Non-Working demo here - http://macklabmedia.com/tweet/
© Stack Overflow or respective owner