Having Trouble with Your Instafeed Script

I've been working on a project that involves integrating an Instagram feed into a website. However, I'm facing difficulties getting it to function properly. Here's the code that I have implemented.

<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>&hearts; {{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>

If anyone could help me identify and fix the issues with this script, I would greatly appreciate it. The initial example was taken from the Instafeed website for reference. You can find the website at www.hemeon.com. My specific website where I am trying to implement this is located at www.vcluxe.nu/contact-me. Thank you!

Answer №1

Hey there! One thing I noticed missing from the instafeed page is mentioning the importance of adding a "limit" to specify how many images to display. Otherwise, it seems the default is zero.

In my case, I set mine as: limit: '4'

It would be beneficial to include this tip in the instructions for others!

Check out the example below:

 <script type="text/javascript>
    var feed = new Instafeed({
        get: 'tagged',
        tagName: 'cool',
        clientId: '916c01b8624d43c7b4b76369aruc86a0',
        limit: '4' 
    });
    feed.run(); </script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to eliminate excessive margin-bottom on a floating image?

Is it possible to maintain the same margin at the right and bottom of an image when using <img> inside <p><img style="float:left">dummy text dummy text dummy text dummy text</p>? ...

Interactive Conversation Interface for Customer Communication

I've noticed on a lot of websites that companies often place contact forms, login or sign up forms in the lower right corner, similar to a chat box. When you hover and click on it, a full form opens up for users to submit data. I'd like to impl ...

Universal compatibility for web displays

I've been conducting testing on a website across Chrome, Firefox, and Internet Explorer, utilizing the CSS code snippet below: #foot_links1, #foot_links2, #foot_links3 { position: absolute; margin-top: 55px; margin-top: 14em; color: # ...

Creating a unique ticket ID in Flask Python involves combining a string with an incremented integer value. This process ensures that

I am working on developing a Ticketing System using Python Flask and storing it in SQLite. However, I am facing challenges when trying to store the ticket ID. My expectation is that the ticket ID will be a combination of Datetime and an increment number. Y ...

Exploring the best practices for organizing logic within Node.js Express routes

I'm currently utilizing the https://github.com/diegohaz/rest/ boilerplate, but I am unsure about the best practice for implementing logic such as QR code generation and additional validation. My initial thought was to include validation and password ...

Exploring the mechanics behind jQuery selectors

Currently, I'm working on the Interactive website: Push menu training exercise on codecademy. However, I am a bit confused about jquery selectors. Specifically, in the example provided below, why does the 'menu' html element require a ' ...

Attach an event listener to a class, then use the removeEventListener method to detach the listener and eliminate any remaining references, ensuring proper functionality of the

When creating a class in JavaScript, a normal function returns the class object. However, events return the event object and the class object is lost: function class(a){ this.name=a; document.addEventListener('click',this.click,false); xhr.add ...

Multiple requests are being sent via AJAX

Despite numerous other posts addressing the same issue, I have not been able to find a solution for my problem. The AJAX request appears to be sent multiple times. var checkAllStatus = function () { $.ajax({ cache: false, type: "POST", ...

Alert when every ajax call is completed

Here is some code I have written: var chapterNameArr = ['firstchapter','secondchapter','thirdchapter','fourthchapter','fifthchapter','sixthchapter','seventhchapter']; $.each(chapterN ...

Unable to retrieve the length of HTMLCollection

I've been having an issue with accessing all the dynamically created list elements (<li>) on my page using getElementsByTagName. The console keeps showing that the length of my li array is 0. Despite going through documentation and examples rel ...

Tips for utilizing the if-else directive in an AngularJS controller

My current challenge involves HTML coding. <li><strong>Scrub:</strong> {{insuredProfile.permanentAddress.isScrubbed}}</li> This code displays either true or false. I want to show Yes for true and No for false. Using data-ng-if, ...

Unable to interpret data from JSON file

I have written the following code to read a JSON file. It is not throwing any errors, but I am receiving a null value in the variable: var myData = null; $.ajax({ type: 'GET', async: false, url: 'myJson.json', dataType: ...

Adjust the vertical size of the slider in Jssor

Hi there! I'm currently working on a slider that I want to have a dynamic width (100% of the container) and a static height of 550px on PCs, while being responsive on mobile devices. Below is my code snippet: <div class="col-md-6 right-col" id="sl ...

Achieving perfect alignment of an iframe on a webpage

Having an issue with aligning the iframe on my website. I have two buttons set up as onclick events that connect to internal pages displaying PHP data in tables within the iframe. Despite trying various CSS styles and positioning methods, I can't seem ...

Issues with undesirable spacing in CSS using the display property and table-cell display type

Having trouble grasping the concept of table and table-cell in css? See this example: http://jsfiddle.net/dd7h7/3/. HTML <div class="widget"> <div class="button"> <div class="content"> <div class="icon">A</div> ...

Not enough test coverage with Jest

Here is the code snippet I am working with: <ReturnToLastSearch href={'/listings'} onClick={(e): void => { e.preventDefault(); router.back(); }} /> The function ReturnToLastSearch( ...

The value of type 'X' cannot be assigned to type 'Y' or 'undefined'

In my code, there is a component that requires a prop with an enum value: export enum AType { some = "SOME", word = "WORD", } const MyComponent = (arg: AType) => {} When I try calling this component like so: <MyComponent ar ...

Error message 23000: The integrity constraint has been violated. The column "page_id" cannot have a null value in Laravel version 5

Currently, I am using Laravel 5.2 along with jQuery AJAX to work on an application where I need to pass a large amount of data through AJAX requests. However, when dealing with larger datasets, I encountered the following error: SQLSTATE[23000]: Integrity ...

Achieving a smooth transition from a blur-out effect to a blur-in effect on a background Div

I created a blur in/out effect for my landing page, but it's not functioning as expected and I'm not sure why. It blurs out correctly, but the issue arises when I want the underlying Div to fade in. Currently, it just appears abruptly after the ...

Retrieve highlighted text along with its corresponding tag in ReactJS

my <span class="highlight">highlighted</span> word The text above is showing an example including HTML tags. However, when using window.getSelection(), only the text "my highlighted word" is returned without the surrounding <span& ...