本文介绍了Instafeed JS无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试测试instafeed.js,但无法将其加载到简单的引导页面上

I'm trying to test out instafeed.js and I can't get it to load on a simple bootstrap page

页面上的所有内容都会加载,包括这个容器,但是它是空的,没有Instagram代码的提示.

Everything on my page loads, including this container, but it's empty with no hint of Instagram code.

我在根目录下下载了instafeed js文件夹.工作文件与此instafeed文件夹位于同一文件夹中,而min.js文件位于该文件夹中.

I downloaded the instafeed js folder, in my root directory. The working file is in the same folder as this instafeed folder, and the min.js file is in there.

很明显,我的客户ID被省略了,但是除此之外,我在这里怎么做错了?

Obviously, my client ID was omitted, but other than that, what could I be doing wrong here?

这是我当前与此有关的代码块:

Here is my current code block pertaining to this:

<head>
<script type="text/javascript" src="instafeed.js-master/instafeed.min.js"></script>
</head>

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


<script type="text/javascript">
$(document).ready(function() {
  var feed = new Instafeed({
    clientId: 'myclientid',
    limit: '4'
    });
  feed.run();
});
</script>

推荐答案

您还需要包括访问令牌从此处获取访问令牌: http://instagramwordpress.rafsegat.com/docs/获取访问令牌/

you need to include your access token as wellGet your access token from here : http://instagramwordpress.rafsegat.com/docs/get-access-token/

这是我的样品,

if ($instafeed.length) {
            var feed = new Instafeed({
                get: 'user',
                limit: 8,
                userId: userId,
                accessToken: accessToken,
                template: '<a target="_blank" href="{{link}}"><img src="{{image}}" /><div class="instagram-post-stats"><div class="likes">{{likes}}</div><div class="comments">{{comments}}</div></div><i class="fa fa-instagram"></i></a>',
                resolution: 'standard_resolution',
                sortBy: 'most-recent',
            });
        }
            feed.run();
        });
    }
        feed.run();

这篇关于Instafeed JS无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 16:03