<div id="jTweetsAnywhereEndlessScrollingSample">
</div>
<script type="text/javascript">
$('#jTweetsAnywhereEndlessScrollingSample').jTweetsAnywhere({
username: 'themattharris',
count: 20,
showTweetFeed: {
showProfileImages: true,
showUserScreenNames: true,
paging: {
mode: 'endless-scroll'
}
},
onDataRequestHandler: function(stats) {
if (stats.dataRequestCount < 11) {
return true;
}
else {
alert("To avoid struggling with Twitter's rate limit, we stop loading data after 10 API calls.");
}
}
});
</script>
Here's the code to create the tweet feed.
The supplied onDataRequestHandler event handler is used to limit the number of Twitter API calls to
a maximum of 10, to avoid the exhaustion of remaining Twitter API calls, before the rate limit is reached.
HINT: Don't forget to set the height of the tweet feed element (.jta-tweet-list) in your CSS to get a scrollbar! You should also set the "overflow" attribute to "auto". See the CSS for this sample below.
#jTweetsAnywhereEndlessScrollingSample .jta-tweet-list
{
height: 400px;
overflow:auto;
}