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

Processing requests through Axios and Express using the methods GET, POST, PUT, and DELETE

When working with express router and Axios (as well as many other frameworks/APIs), the use of GET/POST/PUT/DELETE methods is common. Why are these methods specified, and what are their differences? I understand that a GET request is used to retrieve dat ...

What is the best way to search the NPM REST API in order to find the most accurate results?

I'm trying to find an effective way to query the npm REST API in order to get relevant search results. I aim to seamlessly integrate this search feature into my application. For instance, when I search for "bootstrap" on npm, I receive various result ...

Modify the style of a webpage through JavaScript

Need help with calling a JS event based on button presses and changing CSS font styling accordingly for each button? Check out the code snippet below: body { background-image: url("back2.jpg"); background-size: 100% 100%; } ...

While attempting to use JavaScript and AJAX to read a JSON object, I encountered an issue caused by the CORS

<!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>Docu ...

Increment the name field automatically and track the number of auto-increment variables being sent through serialization

I am trying to implement a functionality where users can add more inputs by pressing a button, each representing an additional 'guest'. The issue I am facing is with auto-incrementing the JavaScript so that new inputs are added with an incremente ...

Having trouble getting the alert text on the left side of a Bootstrap button with the alert class

Hey there, I managed to create two buttons aligned on opposite sides of my webpage - one on the left and one on the right. Each button, when clicked, displays an alert text on its corresponding side, similar to what you see in this picture The code snippe ...

Can data be transferred between browsers, such as from Google Chrome to Mozilla Firefox?

I have a dilemma with two separate pages—one for Admin and the other for User. The Admin page is named index.html <!DOCTYPE html> <html lang="en"> <head> <style> * { padding: 0; ...

Exploring the differences in performance between React hooks and React classes

Currently, I am delving into understanding React hooks and could use some assistance with comprehending whether every time a React function renders, the hook state resets. Below is a brief example related to fixing a header on scroll: class Header extends ...

Looking to center a title in React Navigation without interference from headerLeft?

I am using react navigation and trying to center the title in the header bar. However, it seems to be affected by the presence of headerLeft. When I disable headerLeft, the title centers perfectly. How can I achieve this without interference from other lef ...

How can you organize an array into rows and columns for easier viewing?

Hopefully everything is clear. I am open to making changes if needed to address any important points. In one of my components, the array items are displayed within cards as shown below: <b-card-group deck class="mb-3"> <b-card border-variant ...

The combination of Javascript and CSS allows for interactive and visually

I'm currently working on a project where I had to create a simulated weather page using only Javascript. However, I am struggling with the overall layout and have a few questions that I hope someone can help me with: Despite trying various methods ...

Fetching a Django view using an AJAX call and extracting the task_id from a Celery task

I have been facing a challenge trying to display data from a celery task in a separate window. My expertise in JavaScript and AJAX is limited, which is where I am encountering issues. Once a view is executed, the celery task commences and the subsequent HT ...

Create a new JSON file to preserve the value of a JSON object

I am working with a JSON file that looks like this: { "soils": [{ "mukey": "658854", "mukeyName": "Meggett-Kenansville-Garcon-Eunola-Blanton-Bigbee (s1517)", "sl_source": "Fl soil map", "cokey": "3035468", "soilName": "Eunola", " ...

Increase the dimensions of the jQuery modal confirmation box

I am working on a jQuery confirmation dialog that displays some details for the user. My goal is to have the dialog adjust its dimensions after the user clicks "YES" to show a smaller text like "Please wait...". How can I dynamically change the size of the ...

Tips for automatically updating a MaterialUI DataGrid in a React JS application

Here's an overview of my current project: Users can save rows from deletion by clicking checkboxes (multiple rows at a time). Any unchecked records are deleted when the user hits the "purge records" button. I received some guidance on how to achieve ...

Fixed Positioning Div to Stay at the Top while Scrolling

Currently, I have successfully implemented the functionality to stick the div to the top once it scrolls down by 320px. However, I am curious if there is an alternative approach to achieving this effect. Below is the code snippet I am using: jQuery(functi ...

Using absolute elements within a div that is positioned relative in HTML code

In the layout below: <div style="margin-top:0%" class="postcell"> <div id="postspantitle" > <span class="texts"><?php echo __('Başlık :', 'goldmem');?></span> </div> & ...

Utilizing Selenium with Java, you can hover over a button and choose to click on any of the available options

Currently, I am utilizing Selenium to automate the user interface using Java. Within the UI, there is an action button that, when hovered over by the User, displays two clickable options - Create and Edit. For ease of use, I have stored CSS locators as E ...

Dynamic jQuery URL truncater

Is there an on-the-fly URL shortener similar to Tweetdeck available? I have come across several jQuery and JavaScript plugins that can shorten a URL through services like bit.ly when a button is clicked. However, I am looking for one that shortens URLs aut ...

Transmit information from JavaScript to a servlet and receive a response in return

I'm new to using ajax and JavaScript. Currently, I have a simple jsp page containing HTML and an accompanying JavaScript file with all my functions defined. One of these functions sends JSON data to a servlet and now I need assistance in receiving th ...