Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6072389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:09:16+00:00 2026-05-23T10:09:16+00:00

On a site I am building, I need to allow the video (iframe embed)

  • 0

On a site I am building, I need to allow the video (iframe embed) to dynamically stretch to fit the screen. I will be grabbing the width of the parent div with jQuery, but I need to work out the math to automatically work out the height size.

YouTube has managed to do this in their custom sizer (click share, then embed and fill in the width to see the height automatically fill in).

Any ideas would be really useful, thanks!


Edit

Thanks to Eray for the help with this! If anyone is interested, here is the final working code (I think it works, anyway!):

$documentWidth = $('#wrap').width();
$theWidth = parseInt($documentWidth, 10);
$theHeight = (Math.floor($theWidth / 1.755) || 0) + 30;
$('#video iframe').height($theHeight);
$('#video iframe').width($documentWidth);

I am still not 100% sure how it works!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:09:17+00:00Added an answer on May 23, 2026 at 10:09 am

    Get original width/height ratio . And then use this formula :

    New Width = New Height * (Original Width/Original Height)
    

    So you will keep same ratio on new width height combination.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a site and need to allow users to be able to create
I am building a site that will (obvisouly) have a front end public portion
We are building a site using asp.net mvc. We want to allow the user
Hey I'm building an app that will allow a user to log into a
I'm building a web app that will (ideally) allow users to follow discussion threads
I'm building a paid membership site in php using the Zend Framework. I need
I have a scenario inwhich users of a site I am building need the
I'm building a site where i need to be able to notify a user
I am building a site in Wicket. I need to serve a JavaScript file,
I'm building a site right now, so far I've painfully forced everything to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.