0

jQuery(document).ready(function($) {
  $("img[data-data-src]").each(function(index) {
    var vimeoId = $(this).data('data-src');
    // Endpoint: https://vimeo.com/api/oembed.json?url=https%3A//vimeo.com/
    $.getJSON('https://vimeo.com/api/oembed.json?url=https%3A//vimeo.com/' + vimeoId, {
        format: "json",
        width: "640"
      },
      function(data) {
        $("img[data-data-src=" + vimeoId + "]").attr('src', data.thumbnail_url);
      });
  });
});

HTML

<a href="//player.vimeo.com/video/54943111" class="vimeo-video">
 <img data-vimeo-id="54943111" src="" />
</a>
<a href="//player.vimeo.com/video/57600809" class="vimeo-video">
  <img data-vimeo-id="57600809" src="" />
</a>

Jagdish Sarma Asked question August 24, 2022
Add a Comment