javascript - Instafeed.js 不工作

标签 javascript instafeedjs

我正在尝试使用 Instafeed.js,但我的代码无法运行。我尝试了下载按钮the InstafeedJS website ,但它只显示代码。我将该代码复制到一个文件中,将其另存为 instafeed.min.js,并将其链接到我的网页。我按照 Instafeed 网站上的步骤操作,但没有成功。

这是我的代码:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script type="text/javascript" src="instafeed.min.js"></script>

  <script type="text/javascript">
  var feed = new Instafeed({
    get: 'tagged',
    tagName: 'awesome',
    clientId: 'CLIENT-ID',
    accessToken: 'ACCESS-TOKEN',
    template: '<li><div><a href="{{link}}"><img src="{{image}}" /></a> <h3>{{caption}}</h3></div></li>',
    resolution: 'standard_resolution'
    });
    feed.run();
</script>
</head>
<body>

  <div id="instafeed"></div>

</body>
</html>

请记住,我确实有正确的 clientID 和 accessToken,但我没有将它们放入上面的代码中,因此其他人无法使用它们。

最佳答案

尝试输入 <script></script> <body> 中的标签,在<div id="instafeed"></div>之后。 JS 可能在 DOM 加载之前运行。

关于javascript - Instafeed.js 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39317597/

相关文章:

javascript - 使用 reduce() 改变数组的顺序

javascript - 如何在 NodeJS 请求模块中发出此 curl 请求?

javascript - 将内容从网站剥离到我的网站

javascript - append json_encode 时出现问题

javascript - instafeed.js 获取特定用户喜欢的媒体列表

javascript - 单击超链接时如何将 href 值传递给 javascript 并在 window.location 中使用它?

javascript - Instafeed.js 不在页面上显示图像

javascript - 使用从 Instafeed.js 中提取的照片构建 Owl Carousel

image - Instafeed : skip retrieving video type posts from feed