D
D
Dmitry Shchurov2020-04-17 05:38:13
JavaScript
Dmitry Shchurov, 2020-04-17 05:38:13

How to display a video on a website page using php + js?

How to display a video on a website page using php + js ?

js and html code works fine.
It is necessary that the video by "movie_id" is displayed on the "movies" page and others are "hidden"

<video class=" " controls="controls" width="100%" >
<source src="https://example.com/example.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
</video>

or an html block was displayed in which there will be a video player.

Пример блока:
<article class="">
<video class=" " controls="controls" width="100%" >
<source src="https://example.com/example.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
</video>
</article>


js code 
$(function(){

$('.movie .list li').click(function(){
var movie_id = $(this).attr('data-id');
$('.trailerMovie').append('<iframe src="https://www.example.com/movies/' + movie_id + '?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>');
$('.modal_wrapper').stop().fadeIn('slow');
$('.modalBg,.trailerModal,.btn_modalClose').click( function(){
$('.modal_wrapper').stop().fadeOut('slow',function (){
$('.trailerMovie').empty();
$('.modal_wrapper').css('display','none') ;
});
});
});
});

И html code 

<div class="modal_wrapper">
<div class="modalBg"></div>
<div class="trailerModal">
<div class="btn_modalClose"><span></span></div>
<div class="trailerMovie"></div>
</div>
</div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question