Instafeed JS not loading

泄露秘密 提交于 2021-01-29 09:55:57

问题


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

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

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.

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>

回答1:


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

Here is my sample,

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();


来源:https://stackoverflow.com/questions/50767598/instafeed-js-not-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!