Looking for a jQuery/JS solution for making a Youtube video responsive


#1

Hi,

Looking for a solution to make a Youtube video iframe responsive I found this page:

Fluid Width Video

Now I’m trying for hours to apply it on my code example here:

Trying to make it responsive

but it’s not working and I don’t understand why.

Could you please help me with this? I’m not looking for a CSS solution. I’m looking for a jQuery/JS solution.

Thanks


#2

I use a much simpler approach as can been seen in the video at the top of the following page:

https://www.kirupa.com/html5/arrays_javascript.htm

Would this work for you? We can look into turning into JS afterwards :slight_smile:


#3

Hi @kirupa,
Thanks a lot for your help.
Yes, I know the CSS solution, which is really cool.
But in this particular case, I wanted a working solution with JavaScript.
Meanwhile I managed to find a solution with JS, which is here:
Responsive Youtube videos

I will appreciate any suggestions to improve that JS code.
Thanks again.


#4

That JS code looks fine! Go for it :slight_smile: