Home>

Good day to all. I have a very uncomfortable situation happened. This is due to the video playback on the site. When I turn on the video, everything is chain, and also normally close. But at the same time the sound continues to work (at the time of closing the video, it works as if in the back background). I have already been looking for where you can, but anywhere did not really say anything. As well as to implement a function at which you can close the video, not only when pulling into the cross, but also when you click outside the video.

<
DIV Class= "Row" >
               ≪
DIV CLASS= "COL" >
                ≪
DIV CLASS= "Feuter-img" >
                ≪
img src= "media /c663e8dd2803d21126882426e7a0cd60.jpg" >
                ≪
img src= "img /svg /play-button.png" class= "play-btn" onclick= "playvideo ('video /warme theke.mp4')" >
         ≪
/div >
    div class= "video-player" id= "videoplayer" >
        ≪
Video width= "100%" Controls AutoPlay id= "Video" >
            ≪
Source SRC= "Video /Warme Theke.mp4" Type= "Video /MP4" >
        ≪
/Video >
        ≪
img src= "img /svg /stop.png" class= "close-btn" onclick= "stopvideo ()" >
    ≪
/div >
*** js ***
var videoplayer= document.getelementByid ("VideoPlayer");
var video= document.gelementbyid ("Video");
FUNCTION STOPVIDEO () {
    VideoPlayer.Style.Display= "None";
$ ('. Close-Btn'). click (function () {
    P.CSS ('DISPLAY', 'NONE');
    $ (this) .next () [0] .pause ();
})
    }
Function PlayVideo (File) {
    Video.Src= File;
    VideoPlayer.Style.Display= "Block";
}

p.s I myself face the JS and I'm just learning to use it. I will be very sente for solving a tax problem.

Thanks for the help.

Why in the StopVideo function you hang a click handler on $ ('close-btn')?

Stepan Kasyanenko2021-09-16 18:52:20

It was vague. But the sound is still followed by Function StopVideo () {videoplayer.style.display= "none"; } Or I lack knowledge or I do not understand something.

user35854552021-09-16 18:52:20

You do not understand how to write code on JS :). You do not need to hang the $ ('. Close-Btn'] click handler. Click, write the codeOplayer.pause () code immediately in StopVideo.

Stepan Kasyanenko2021-09-16 18:52:20

Yes, I just wrote that I am a full profan in JS, now trying to study it. I'm trying to understand my best. Now when you click on close, it does not rotate at all. What I do not understand or something I do not at all as it should do it. Forgive me for stupid questions. If you mean about the code: Function StopVideo () {where it is necessary to insert videoplayer.pause (), then it does not react at all. Could you show how it is possible to write this code to work. Unless of course you are not difficult.

user35854552021-09-16 18:52:20