I can not understand why the video is not embedded on the site. Here is the code:

<div id="video-wrap-footer"> </div> var windowRes = document.documentElement.clientWidth; function videoAdd() { if (windowRes > 1023) { document.getElementById('video-wrap-footer').innerHTML = '<video autoplay id="bgvid_footer" poster="img/water-on-glass.jpg"><source src="videos/medoff-video.webm" type="video/webm"><source src="videos/medoff-video.mp4" type="video/mp4"></video>'; } } video#bgvid, video#bgvid_footer { position: fixed; top: 50%; margin-left: -1px; left: 50%; min-width: 100%; min-height: 100%; width: auto; height: auto; z-index: -100; -ms-transform: translateX(-50%) translateY(-50%); -moz-transform: translateX(-50%) translateY(-50%); -webkit-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); background-size: cover; } 

I see it in the code, through the web inspector, but in the browser there is no

  • one
    What is in the windowRes variable? - Kison
  • @Kison, I apologize, updated the answer - Nikita Shchypylov
  • Are you sure that (windowRes> 1023) is true? - Kison
  • @Kison Sure)) - Nikita Shchypylov September

2 answers 2

Try this:

 function addSourceToVideo(element, src, type) { var source = document.createElement('source'); source.src = src; source.type = type; element.appendChild(source); } var video = document.createElement('video'); document.body.appendChild(video); addSourceToVideo(video, 'http://upload.wikimedia.org/wikipedia/commons/7/79/Big_Buck_Bunny_small.ogv', 'video/ogg'); video.play(); 

Taken from here

    SOLUTION FOUND The problem was in the plugin, which knocked positioning and video "stuck" to the hider. Thanks to all!