我想我可能快到了(感谢其他一些人的帮助),但似乎仍然无法让我的推文在循环中一次显示一个
var $container = $('#innerTwitter');
$.get('/feed', function (data) {
showTweets($(data).slice(0, 5))
}, 'json');
function showTweets(tweets) {
var tweetPs = $.map(tweets, function (t) {
return $('<p></p>').text(t.text).hide();
});
$container.append(tweetPs);
tweetPs[0].show();
var currentIndex = 0;
var nextTweet = function () {
var nextIndex = currentIndex == tweetPs.length - 1 ? 0 : currentIndex + 1;
tweetPs[currentIndex].fadeOut(400, function () {
tweetPs[nextIndex].fadeIn(400);
});
currentIndex = nextIndex;
};
setInterval(nextTweet, 2000);
}
在我的控制台(Chrome)中,我收到此错误
Uncaught Error: NotFoundError: DOM Exception 8
谁能看到我做错了什么
任何帮助表示赞赏