I'm making a responsive website and I have a video background for the first screen, I want to hide the video on the mobile devices to make the site load faster. for sure display: none; will not disable the content from downloading.. I tried those two javascript to disable the content from loading the content on smaller screens but it still loads on the background:
if (screen.width < 768){
var removeelement = document.getElementById("videoClass");
removeelement.innerHTML = "";
}
Or :
$("#videoClass").remove();
they do the same work of CSS tag : display-none. Is there any way in javascript to prevent the content from loading the content in the background ?