Instagram Loader

Loads on doc ready from data attribute.

by GioLogist

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<did data-igpost="BPepRv-g8A5">
  
</did>
<did data-igpost="BNPqxXaB-Kt">
  
</did>

JavaScript

$(document).ready(function(){
  $('[data-igpost]').each(function(i){
  	var el = this;
    var igid = $(el).attr('data-igpost');
    $.getJSON(
      'https://api.instagram.com/oembed/?url=http://instagr.am/p/' + igid + '/&callback=?',
      function(data) {
          $(el).html(data.html);
      }
    );
 });
});