Skip to content

Instantly share code, notes, and snippets.

@Antoinebr
Created February 9, 2016 14:54
Show Gist options
  • Select an option

  • Save Antoinebr/dd6a059826af15aeaf81 to your computer and use it in GitHub Desktop.

Select an option

Save Antoinebr/dd6a059826af15aeaf81 to your computer and use it in GitHub Desktop.
instagram.js
var userId = 1282926470;
var clientId = 'b2c4628sdsdda9900914746bb80f0c4523ef7fa6';
var myurl = "https://api.instagram.com/v1/users/"+userId+"/media/recent/?client_id="+clientId;
$.ajax({
dataType: "jsonp", // Pour eviter de prbs avec le cross domaine on met jsonp
url: myurl ,
}).done(function ( data ) {
var items = []; // On créer un Array vide
$.each( data, function( key, val ) { // pour chaque entré du Json
items.push(val); // On pousse la valeuu dans l'array
});
for (i = 0; i < 16; i++) { // pour afficher 16 images
$("#home-instagram-img").append("<a class='ab-gallery-item' href='"+items[2][i].images.standard_resolution.url+"'><img src='"+items[2][i].images.thumbnail.url+"'></a>");
}
});
@Antoinebr
Copy link
Author

Ce script utilise jQuery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment