The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Setting video height (as well as width) with FitVid

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #151221

    I’m using FitVids to implement fluid video on this simple page. The video scales horizontally as I’d hope and works fine as long as the aspect ratio of its parent is >16:9 but if it’s wider than that the video doesn’t scale vertically to fit.

    At the moment I’m setting overflow:hidden on the parent so the bottom of the video just gets clipped.

    Could anyone tell me if this is the intended behavior of FitVids or is there something wrong in my implementation? I am very much a beginner when it comes to js so any help would be very much appreciated.

    Thanks in advance.

    EDIT: Thanks for reading but I’ve actually just managed to implement a workaround. If anyone’s interested, what I’ve done is detect the height of the viewport and set the max-width of the video’s using a calculation based on that. It’s probably not the neatest solution but I think it’ll do for now.

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.