Thursday, 28 March 2019

How to embed an Instagram carousel in particular index?

I'm using https://api.instagram.com/oembed to embed an Instagram carousel (e.g. https://www.instagram.com/p/BvRwa1tArMo).

I was wondering if there's a way to select the index of the carousel image. For example, in this case, I'd like the embedding to show the second image instead of the first one.

My simplified code is:

$.get(
  'https://api.instagram.com/oembed?url=https://www.instagram.com/p/BvRwa1tArMo&hidecaption=1&omitscript=1',
  function (data) {
    $('#ig-post').html(data.html);
  }
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://www.instagram.com/embed.js"></script>
<div id="ig-post"></div>

(For some reason it doesn't fully work here but it does in jsfiddle: https://jsfiddle.net/43veku7t/)



from How to embed an Instagram carousel in particular index?

No comments:

Post a Comment