I have a website siavoush-re.co.uk which is linked to my Instagram account using Instafeed.js. To use instafeed.js I have to create a new instance of it with properties of my choosing. I am trying to add a property to the instance depending on the screen size using an if statement, here is what I have done so far,
var feed = new Instafeed({
get: 'user',
userId: private,
limit: 21,
accessToken: 'private',
});
if (document.documentElement.clientWidth > 600 ) {
feed.resolution = 'low_resolution';
};
feed.run();
I am new to javascript, what would be the correct implementation?
Your syntax is correct, but I think this is what you intended:
feed.options.resolution = 'low_resolution';
In terms of JavaScript, the approach you had was totally valid. But the Instafeed.js library you mentioned stores all of the configuration values on a nested options
property.