Answer the question
In order to leave comments, you need to log in
How to play video on button click? But how to solve one small problem?
Guys!!! I beg you, help!!
There are a lot of videos on the site, and how can I run each one separately, with minimal js code.
I don't want to write my own code for each video.
In each block with a video there will be a button, when clicked, the video should start.
How to do it!!!
Answer the question
In order to leave comments, you need to log in
If you use jquery then:
$('.button_class').click(function(){
var video_params = $(this).parent().data('video');
// тут запуск проигрывателя и прочее
})
<div class="video_block" data-video="параметры видео для запуска">
<div class="button_class"></div>
</div>
<div class="video_block" data-video="параметры видео для запуска">
<div class="button_class"></div>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question