Jump to content

Playing background video

Recommended Posts

Hello, I'm using the Encore template, which won't allow me to play background video on every page of our website (thelab.org). For the code injection I'm using the below code, which seems to work for me on Chrome, Safari, and Firefox, but won't autoplay for other users on other computers. Any ideas on how to get this to play across the board?

  window.onload = function() {
    var iframe = document.createElement('iframe');
    iframe.id = "bg_video"
    iframe.style.cssText = "border:none;width:100vw;height:100vh;position:fixed;top:0px;left:0px;z-index:1;";
    iframe.src = "https://player.vimeo.com/video/362211620?autoplay=1&width=100" ;
    document.body.appendChild(iframe);
    resizeIframe();
    window.onresize = resizeIframe;
    var wrap = document.getElementById('outerWrapper');
    wrap.style.zIndex = '2';
};

 

Thank you for any help you can provide!

Link to comment
  • Replies 0
  • Views 468
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.