$(document).foundation() function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie !== '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) === (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } var restrictedElements = []; function removeBehaviorsRestrictions(event) { if (restrictedElements.length > 0) { var rElements = restrictedElements; restrictedElements = []; rElements.forEach(function(video) { if (video.autoplay && video.paused) { video.load() video.play() if (video.paused) { restrictedElements.push(video) } } else if (video.readyState < 4) { video.load() } }); } } if (document.querySelector('video')) { let video = document.createElement('video'); video.muted = true video.play(); if (video.paused) { restrictedElements = document.querySelectorAll('video.gif') window.addEventListener('keydown', removeBehaviorsRestrictions); window.addEventListener('mousedown', removeBehaviorsRestrictions); window.addEventListener('touchstart', removeBehaviorsRestrictions); restrictedElements.forEach(video => { if (!video.poster) { video.poster = video.src.replace('.mp4', '.jpg') video.muted = true } }) } }