whatisgithub

What is fitvids.js?

davatron5000/fitvids.js — explained in plain English

Analysis updated 2026-06-26

4,717HTMLAudience · developerComplexity · 1/5Setup · easy

In one sentence

A jQuery plugin that makes embedded YouTube and Vimeo videos resize proportionally at any screen width, solving the fixed-size iframe problem in responsive web designs with a single function call.

Mindmap

mindmap
  root((fitvids))
    What it does
      Resize video iframes
      Responsive scaling
      CSS wrapper
    Supported players
      YouTube
      Vimeo
      Custom selectors
    Options
      Ignore selector
      Custom player
    Use cases
      Responsive blogs
      CMS sites
      Video landing pages
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Make embedded YouTube or Vimeo iframes scale proportionally on a responsive website without writing custom CSS.

USE CASE 2

Apply FitVids to a blog or CMS so all video embeds resize correctly on mobile without editing each embed code individually.

USE CASE 3

Extend FitVids with a custom selector to support a non-standard video provider that outputs fixed-size iframes.

What is it built with?

JavaScriptjQueryCSS

How does it compare?

davatron5000/fitvids.jsuswds/public-sansremy/html5demos
Stars4,7174,7174,728
LanguageHTMLHTMLHTML
Setup difficultyeasyeasyeasy
Complexity1/51/51/5
Audiencedeveloperdesignerdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires jQuery 1.7 or later, the plugin itself is just one script include away.

So what is it?

FitVids.js is a small jQuery plugin that solves a common layout problem in responsive web design: embedded videos that refuse to resize properly when the browser window changes width. YouTube, Vimeo, and a handful of other players produce fixed-size iframes by default, which break on narrow screens. FitVids automatically wraps each video in a container that scales proportionally, so the video fills its column at any screen size. To use it, you include jQuery (version 1.7 or later) and the FitVids script in your page, then call .fitVids() on the element that contains your videos. From that point on, the sizing is handled entirely by percentage-based CSS. The script sets up the wrapper once, no ongoing JavaScript is needed after the initial call. The plugin ships with built-in support for YouTube and Vimeo. Blip.tv, Viddler, and Kickstarter were supported at some point but may be deprecated. If you use a video provider that is not on the default list, you can pass a custom CSS selector to tell FitVids which iframes to include. This is also the recommended way to test whether a given player works well with the scaling approach. There is also an option to exclude specific videos or containers. Adding a fitvidsignore class to an element tells the plugin to skip it, or you can pass a list of selectors via the ignore option if you prefer not to modify your markup. One known limitation: Vimeo's Autoplay API does not work with FitVids in Internet Explorer 11. For videos that need to autoplay in that browser, you have to wrap them manually. The library is a focused solution to a narrow problem that was widespread during the rise of responsive design.

Copy-paste prompts

Prompt 1
Show me the minimal setup to add FitVids.js so all YouTube and Vimeo embeds inside a div with class .content resize responsively.
Prompt 2
I have YouTube embeds and a custom player from a non-standard provider. How do I configure FitVids to handle both using customSelector?
Prompt 3
What does FitVids.js actually change in the DOM? Walk me through the wrapper it creates and the CSS it applies to scale the video.

Frequently asked questions

What is fitvids.js?

A jQuery plugin that makes embedded YouTube and Vimeo videos resize proportionally at any screen width, solving the fixed-size iframe problem in responsive web designs with a single function call.

What language is fitvids.js written in?

Mainly HTML. The stack also includes JavaScript, jQuery, CSS.

How hard is fitvids.js to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is fitvids.js for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.