Streaming live at 10am (PST)

Video Fit to Width OR Height of Viewport


#1

Hi everyone,

Trying to get this bit of javascript to work for an embedded HTML5 video. The goal is when the viewport is wider than it is tall, that the video fit to the height. When the viewport is taller than it is wide, the video should fit to the width.

Public site is here (page called "Chapter 1"):
https://preview.webflow.com/preview/zsr-all-for-nc-microsite?preview=fdfb8b7b99cc24ce3fb87b0ca1adb2c6

Javascript I found is here (first answer below question. See "Solved it myself with a javascript function...")

Kinda new at calling the javascript, what am I doing wrong?

Would also be open to other ideas of achieving this besides this script. I've found a few things in StackOverflow but nothing is working for me.