T
T
tigra2016-01-31 17:32:33
YouTube
tigra, 2016-01-31 17:32:33

How to turn off youtube video when modal closes?

https://jsfiddle.net/yo7j2eo6/
Actually, if you turn on the video and then close the modal window, the video will continue to play. What to add to stop the video?
This implementation is of interest, without connecting third-party scripts

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Tretyakov, 2016-01-31
@tigroid3

You can simply remove the iframe and insert it when needed.
In Jquery, you can remove an element using the - remove ()
function. And add an element with append ()
That is, when you closed the window, you delete the iframe.
Here is an example of how an iframe is deleted https://jsfiddle.net/o0xusd7h/
You can not delete it, but change the src to empty.

G
Gran Torino, 2018-09-19
@adrin13

Though belated, but still exile

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question