Created
February 9, 2016 14:54
-
-
Save Antoinebr/dd6a059826af15aeaf81 to your computer and use it in GitHub Desktop.
instagram.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>"); | |
| } | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ce script utilise jQuery