Click on the Link and open a player below it

5

I have some links, for example: Link1 Link2 Link3 Link4 and I would like that when I click on Linkx it opens an "embed" just below it and that each Link brings its corresponding video. / p>

I'm working on a theme wordpress, in which I'm trying to modify some parts ... I could not solve this question because I do not know how to hide the videos.

Click on Link1 it opens the video for Link1
Click on Link2 it opens the Link2 video

It has to be on the same page and also has to be just below the link ...

    
asked by anonymous 24.09.2015 / 19:08

1 answer

0

I do not work with wordpress but I believe I can work with jQuery on it normally, right? If you can, you put a listener for each link, in the click action of each link you display or drop a div , where you will open the video. Something like this:

    <a id="link1" href="#">LINK1</a>
    <div id="divvideo1">
        <video id="video1" src="demo.mp4" controls autoplay >HTML5 Video </video> 
    </div>

 <a id="link2" href="#">LINK2</a>
    <div id="divvideo2">
        <video id="video2" src="demo.mp4" controls autoplay >HTML5 Video </video> 
    </div>

<script>

$('#link1').click(function(){

    $('#divvideo2').hide();
    $('#video2').pause();
    $('#divvideo1').show();
    $('#video1').play();

});

</script>

I did not test the code, it may have writing errors, but the idea (from what I understood) would be more or less that.

    
24.09.2015 / 20:21