Snippets Collections
<!-- You can dynamically replace "pqsp8lk5qn" in the HTML with any Wistia video ID -->
<a href="#video" data-wistia-id="pqsp8lk5qn">Play Video</a>

<div class="wistia_embed wistia_async_pqsp8lk5qn popover=true popoverContent=html silentAutoPlay=allow"></div>

<!-- Shameless plug 😉 -->
<a class="twitter" href="https://twitter.com/KeenanPayne_" title="Follow me on Twitter" target="_blank">
    <img src="https://assets.codepen.io/174608/twitter.svg" />
</a>

<script>
  window._wq = window._wq || [];

var $triggerWistia = $('a[href="#video"]');

$triggerWistia.on('click', function() { 
  // Dynamically load Wistia JavaScript API
  var ev1 = document.createElement('script');
  ev1.src = '//fast.wistia.com/assets/external/E-v1.js';
  ev1.async = true;
  ev1.charset = 'ISO-8859-1'
  document.head.appendChild(ev1); 
    
  // Play video after API has loaded
  var $this = $(this);
  var videoId = $this.data('wistia-id');
  
  _wq.push({ 
    id: videoId, onReady: function(video) {
      var hash = window.location.hash;

      if (window.location.hash === '#video') {
        video.play();
      }
    }
  });
});
</script>
star

Fri Mar 05 2021 05:52:15 GMT+0000 (Coordinated Universal Time) https://codepen.io/keenanpayne/pen/JvjVXX

#wistia #lazyload

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension