Javascript Instafeed脚本不工作
我一直在开发一个需要instagram订阅源的网站。不幸的是,我不能让它工作!这就是我所做的Javascript Instafeed脚本不工作,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我一直在开发一个需要instagram订阅源的网站。不幸的是,我不能让它工作!这就是我所做的 <script type="text/javascript"> feed = new Instafeed({ clientId: '99808b1edfc140eda1cfa2dca4b4fe4c', accessToken: '201047212.467ede5.1072e8c882e34a8fb7975f725e7b3ba8', get: 'user',
<script type="text/javascript">
feed = new Instafeed({
clientId: '99808b1edfc140eda1cfa2dca4b4fe4c',
accessToken: '201047212.467ede5.1072e8c882e34a8fb7975f725e7b3ba8',
get: 'user',
userId: 201047212,
resolution: 'standard_resolution',
links: 'false',
template: '<div id="instafeed-caption">{{caption}} <br>♥ {{likes}} on <a href="{{link}}" class="sky">instagram</a></div><div id="instafeed-container"><img src="{{image}}" /></div>',
mock: true,
custom: {
images: [],
currentImage: 0,
showImage: function () {
var result, image;
image = this.options.custom.images[this.options.custom.currentImage];
result = this._makeTemplate(this.options.template, {
model: image,
id: image.id,
link: image.link,
image: image.images[this.options.resolution].url,
caption: this._getObjectProperty(image, 'caption.text'),
likes: image.likes.count,
comments: image.comments.count,
location: this._getObjectProperty(image, 'location.name')
});
(function($){
$("#instafeed").html(result)
})
}
},
success: function (data) {
this.options.custom.images = data.data;
this.options.custom.showImage.call(this);
}
});
feed.run();
(function($){
$(".instafeed-next").click(function () {
var length, current;
current = feed.options.custom.currentImage;
length = feed.options.custom.images.length;
if (current < length - 1) {
feed.options.custom.currentImage++;
feed.options.custom.showImage.call(feed);
}
})
});
(function($){
$(".instafeed-prev").click(function () {
var length, current;
current = feed.options.custom.currentImage;
length = feed.options.custom.images.length;
if (current > 0) {
feed.options.custom.currentImage--
feed.options.custom.showImage.call(feed);
}
})
});
</script>
feed=新Instafeed({
客户ID:'99808B1EDFC140EDA1CFA2DCA4 FE4C',
accessToken:'201047212.467ede5.1072e8c882e34a8fb7975f725e7b3ba8',
获取:“用户”,
用户ID:201047212,
决议:“标准决议”,
链接:'假',
模板:'{caption}}
&hearts;{{likes}}}on',,
莫克:是的,
自定义:{
图像:[],
当前图像:0,
showImage:函数(){
var结果、图像;
image=this.options.custom.images[this.options.custom.currentImage];
结果=此。\生成模板(this.options.template{
型号:图片,
id:image.id,
链接:image.link,
image:image.images[this.options.resolution].url,
标题:this.\u getObjectProperty(图像“caption.text”),
喜欢:image.likes.count,
注释:image.comments.count,
位置:this.\u getObjectProperty(图像“location.name”)
});
(函数($){
$(“#instafeed”).html(结果)
})
}
},
成功:功能(数据){
this.options.custom.images=data.data;
this.options.custom.showImage.call(this);
}
});
feed.run();
(函数($){
$(“.instafeed下一步”)。单击(函数(){
var长度、电流;
当前=feed.options.custom.currentImage;
长度=feed.options.custom.images.length;
如果(电流<长度-1){
feed.options.custom.currentImage++;
feed.options.custom.showImage.call(feed);
}
})
});
(函数($){
$(“.instafeed prev”)。单击(函数(){
var长度、电流;
当前=feed.options.custom.currentImage;
长度=feed.options.custom.images.length;
如果(当前>0){
feed.options.custom.currentImage--
feed.options.custom.showImage.call(feed);
}
})
});
如果有人能告诉我剧本有什么问题,我将不胜感激。我从Instafeed网站上的一个例子中得出了这个结论。该网站仅供参考。我的网站是。谢谢 哦,嘿。。我不知道你所有的代码。。。但instafeed页面似乎没有提到的一点是……增加一个“限制”……这会告诉instagram要投放多少图像。。否则我假设默认值为零 我做了我的:限制:“4” 这将是一个非常有用的信息,以投入到说明 见下文:
<script type="text/javascript">
var feed = new Instafeed({
get: 'tagged',
tagName: 'cool',
clientId: '916c01b8624d43c7b4b76369aruc86a0',
limit: '4'
});
feed.run(); </script>
var feed=新Instafeed({
得到:“标记”,
标记名:“酷”,
客户ID:'916C01B8624D43C7B76369ARUC86A0',
限制:“4”
});
feed.run();
似乎有人试图将异步调用视为同步调用。对不起,我对jQuery不是很在行;你能告诉我剧本有什么问题吗?这对他有效——不知道为什么对我无效。