Created
July 10, 2018 13:23
-
-
Save dougkeeling/146e90a484aa3310cae2b2ed3753fe7d to your computer and use it in GitHub Desktop.
[Make background videos work in iOS/Android] Script to be placed in footer #video #php #mobile #html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place in footer | |
var mobilevideo = document.getElementsByTagName("video"); | |
var i; | |
for (i = 0; i < mobilevideo.length; i++) { | |
mobilevideo[i].setAttribute("playsinline", ""); | |
} | |
// Alternate, gets only the first video | |
var mobilevideo = document.getElementsByTagName("video")[0]; | |
mobilevideo.setAttribute("playsinline", ""); | |
mobilevideo.setAttribute("muted", ""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment