使用jQuery滚动Twitter提要
所以我尝试创建一个滚动推特提要。我按照本教程中的说明进行操作 它不能正常工作。开始加载,然后变为白色。我在评论中注意到一些建议如何纠正这个问题的东西,我认为我已经正确地实现了,但它仍然不起作用。如果有人熟悉这一点,为了使其正常工作,需要从原始代码更改哪些代码 我相信这与此有关:使用jQuery滚动Twitter提要,jquery,css,twitter,Jquery,Css,Twitter,所以我尝试创建一个滚动推特提要。我按照本教程中的说明进行操作 它不能正常工作。开始加载,然后变为白色。我在评论中注意到一些建议如何纠正这个问题的东西,我认为我已经正确地实现了,但它仍然不起作用。如果有人熟悉这一点,为了使其正常工作,需要从原始代码更改哪些代码 我相信这与此有关: // This replaces the <p>Loading...</p> with the tweets insertLatestTweets: function (
// This replaces the <p>Loading...</p> with the tweets
insertLatestTweets: function (username) {
var limit = 5; // How many feeds do you want?
var url = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name= + username + '&count=' + limit + '&callback=?';
// Now ajax in the feeds from twitter.com
$.getJSON(url, function (data) {
// We'll start by creating a normal marquee-element for the tweets
var html = '<marquee behavior="scroll" scrollamount="1" direction="left">';
// Loop through all the tweets and create a link for each
for (var i in data) {
html += '<a href="http://twitter.com/' + username + '#status_' + data[i].id_str + '">' + data[i].text + ' <i>' + Twitter.daysAgo(data[i].created_at) + '</i></a>';
}
html += '</marquee>';
//这将用tweets替换加载…
insertLatestTweets:函数(用户名){
var limit=5;//需要多少个提要?
var url='1〕http://api.twitter.com/1/statuses/user_timeline.json?screen_name= +用户名+'&计数='+限制+'&回调=?';
//现在,twitter.com的订阅源中出现了ajax
$.getJSON(url、函数(数据){
//我们将首先为tweets创建一个普通的字幕元素
var html='';
//循环浏览所有推文,并为每个推文创建链接
用于(数据中的var i){
html+='';
}
html+='';
下面是可能对您的场景有用的twitter片段
<a class="twitter-timeline" href="https://twitter.com/ESPNcricinfo/cricketers-on-twitter"
data-widget-id="286832583709442048" style="width:320px; margin-bottom:20px;
height:290px;" width="320" height="290" data-theme="light"
data-link-color="#0084B4">Tweets from @ESPNcricinfo/cricket-tweeters</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)
[0];if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;
js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);}}
(document,"script","twitter-wjs");
</script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)
[0];如果(!d.getElementById(id)){
js=d.createElement;js.id=id;
js.src=“//platform.twitter.com/widgets.js”;
fjs.parentNode.insertBefore(js,fjs);}
(文件,“脚本”、“推特wjs”);
推特已经贬低了您试图使用的API版本
{"errors": [{"message": "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68}]}
显示您的代码,任何错误您的控制台显示,我们无法帮助您否则。