Answer the question
In order to leave comments, you need to log in
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>
Пример блока:
<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 questionAsk a Question
731 491 924 answers to any question