�
�
â–ª â–ª2015-06-19 01:48:05
Video
â–ª â–ª, 2015-06-19 01:48:05

How to return the initial path to a file through src?

Hello. I have several questions.
1) I made a video on the site page in a block with html5, which plays continuously. I noticed that when scrolling the page, the brakes start because of it. I made a script that, when scrolling down by 750 pixels, turns off the video using the .style.display="none" method. But the video still plays in stealth mode. This I understood from the load on the processor. I decided to do this - document.getElementById('video-file-1').src = "not.found". The problem is that I don't know how to get the video path back if the person has scrolled up the page above 750px. That is, initially the path was src="video/video-1.mp4". Of course, I can write the same path in the script, but then it will not be very good,
How can I return the return path in the script without entering the direct direction to the video?
Here is the script itself:
document.getElementById("scrollup").style.display = "none";
var lolModul = (function(){
window.addEventListener("load",function(){
document.addEventListener("scroll",scrollPage);
});
function scrollPage(){
var scrolled = window.pageYOffset || document.documentElement .scrollTop;
if(scrolled>=750){
document.getElementById("scrollup").style.display="block";
document.getElementById("video-bg-zone").style.display="none";
document .getElementById('video-file-1').src = "not.
document.getElementById("scrollup").style.display="none";
document.getElementById("video-bg-zone").style.display="block";
document.getElementById('video-file-1').src = "../video/video-file.mp4"
}
}
}());
Now, due to the fact that the video has to specify a direct direction in else, I will have to write my own script for each page.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mak Alexey, 2015-08-04
@kingdomofcrooked

In general, this is in the JAVASCRIPT section. And what prevents you from saving the path to a variable before you reset it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question