Instafeed demo get: User

by Michael Lajlev

HTML

<script src="http://instafeedjs.com/js/instafeed.min.js"></script>
<script type="text/javascript">
    // Generated by CoffeeScript 1.3.3
(function(){var e,t;e=function(){function e(e,t){var n,r;this.options={target:"instafeed",get:"popular",resolution:"thumbnail",sortBy:"most-recent",links:!0,mock:!1,useHttp:!1};if(typeof e=="object")for(n in e)r=e[n],this.options[n]=r;this.context=t!=null?t:this,this.unique=this._genKey()}return e.prototype.hasNext=function(){return typeof this.context.nextUrl=="string"&&this.context.nextUrl.length>0},e.prototype.next=function(){return this.hasNext()?this.run(this.context.nextUrl):!1},e.prototype.run=function(t){var n,r,i;if(typeof this.options.clientId!="string"&&typeof this.options.accessToken!="string")throw new Error("Missing clientId or accessToken.");if(typeof this.options.accessToken!="string"&&typeof this.options.clientId!="string")throw new Error("Missing clientId or accessToken.");return this.options.before!=null&&typeof this.options.before=="function"&&this.options.before.call(this),typeof document!="undefined"&&document!==null&&(i=document.createElement("script"),i.id="instafeed-fetcher",i.src=t||this._buildUrl(),n=document.getElementsByTagName("head"),n[0].appendChild(i),r="instafeedCache"+this.unique,window[r]=new e(this.options,this),window[r].unique=this.unique),!0},e.prototype.parse=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S;if(typeof e!="object"){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"Invalid JSON data"),!1;throw new Error("Invalid JSON response")}if(e.meta.code!==200){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,e.meta.error_message),!1;throw new Error("Error from Instagram: "+e.meta.error_message)}if(e.data.length===0){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"No images were returned from Instagram"),!1;throw...

CSS

.instagramFeed {
 padding-bottom: 40px;
 border-bottom: 1px dotted #666666;
}

#instafeed {
 position: relative;
 width: 108%;
 max-width: 108%;
 z-index: 999;
}

#instafeed img {
position: relative;
 width: 20%;
 max-width: 100%;
 margin-right: 4.5%;
 margin-top: 4.5%;
}

#mybutton {
 position: absolute;
 z-index: 999;
 display: block;
 width: 300px;
 text-align:center;
 color: #fff;
 background: #555;
 padding: 15px 30px;
}

JavaScript

var feed = new Instafeed({
target: 'instafeed',
get: 'user',
userId: 484934710,
//tagName: 'love',
accessToken: '484934710.3433732.c52c74a8827a4d8a9357d1912b04c8f2',
clientId: '3433732ada5842a5abce2eddeb702d41',
limit: '12',
sortBy: 'most-recent',
link: 'true',
template: '<a href="{{link}}" target="_blank"><img src="{{image}}" /></a>',
resolution: 'standard_resolution',
// after : function() {  console.log('a'); },
// filter: function(image) {
//  return image.tags && image.tags.indexOf('mrancho') >= 0;
// } // filters the user's medias and get the ones with the specified #hashtag = mrancho
});

// call feed.next() on button click
 $('#mybutton').on('click', function(e) {
     e.preventDefault();
  //console.log(feed);
  feed.next();
 });

 feed.run();