L
L
lenokzz2018-09-25 15:53:30
YouTube
lenokzz, 2018-09-25 15:53:30

Problem autoplaying youtube video in fancybox modal?

Used by fancybox 2 for video modals.
There is a link from the video to YouTube: a class="fancybox-video" href=" https://youtu.be/ ....."
And there is an automatic launch of the modal window after the page is loaded by the click trigger:
$(document). ready(function(){
$(".fancybox-video").fancybox({
...
}).trigger("click");
});
The problem is that when you directly click on the link, the window opens and the video starts playing, and when the page loads, the window opens, but the video does not start. Moreover, such a picture is observed in chrome, opera and mobile phones. In IE and Mozilla everything works fine.
There is a suspicion that this is due to the processing of the trigger, but what exactly is the problem and is it possible to autoload the window with a script at the href specified in the parameters, bypassing the link?

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