instafeedjs loads once only then images disappear! Ruby on Rails 4

63 Views Asked by At

I am using instafeedjs to display images on a simple website I am building and it works great when the page is first loaded. If I navigate away from that page and then come back via navbar "home" button the images won't load/disappear, unless I refresh the page. Has anyone else had this issue and know of a fix? I think it has to do with cache but don't know the workaround. Also I am working in ruby on rails 4. Thanks!

Here is the code I have on the view page:

<section>
    <div class="container">
        <header>
            <div class="instafeed-content">
                <h2 class="text-center">Follow on Instagram</h2>
                <div class="row">
                    <div id="instafeed"></div>
                </div>
                <div class="clearfix"></div>
            </div>
        </header>
    </div>
</section>

Here is the code displaying the script inside my application.html.erb:

I have removed the info for userId, clientId, and accessToken but they are filled in properly in the code.

var userFeed = new Instafeed({ get: 'user', userId: '...', target: 'instafeed', accessToken: '...', clientId: '...', resolution: 'low_resolution', limit: 4, sortBy: 'most-liked', template: '', }); userFeed.run();

I hope this helps!

0

There are 0 best solutions below