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

**URL:** <https://forum.kirupa.com/t/looking-for-a-jquery-js-solution-for-making-a-youtube-video-responsive/638795>\
**Category:** Uncategorized\
**Created:** [October 11, 2018, 2:12pm UTC](https://forum.kirupa.com/t/looking-for-a-jquery-js-solution-for-making-a-youtube-video-responsive/638795 "2018-10-11T14:12:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kayut](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kayut](https://forum.kirupa.com/u/kayut)\
**Post date:** [October 11, 2018, 2:12pm UTC](https://forum.kirupa.com/t/looking-for-a-jquery-js-solution-for-making-a-youtube-video-responsive/638795/1 "2018-10-11T14:12:56Z")

</div>

Hi,

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

[Fluid Width Video](https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php)

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

[Trying to make it responsive](https://codepen.io/itsthomas/pen/xyrOrw?editors=0110)

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

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [October 12, 2018, 3:16pm UTC](https://forum.kirupa.com/t/looking-for-a-jquery-js-solution-for-making-a-youtube-video-responsive/638795/2 "2018-10-12T15:16:13Z")

</div>

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](https://www.kirupa.com/html5/arrays_javascript.htm)

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

---

<div class="post-metadata">

**Author:** ![kayut](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kayut](https://forum.kirupa.com/u/kayut)\
**Post date:** [October 12, 2018, 4:31pm UTC](https://forum.kirupa.com/t/looking-for-a-jquery-js-solution-for-making-a-youtube-video-responsive/638795/3 "2018-10-12T16:31:45Z")

</div>

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](https://codepen.io/itsthomas/pen/ePEgmP)

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

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [October 12, 2018, 9:38pm UTC](https://forum.kirupa.com/t/looking-for-a-jquery-js-solution-for-making-a-youtube-video-responsive/638795/4 "2018-10-12T21:38:33Z")

</div>

That JS code looks fine! Go for it 🙂
