• Stars
    star
    4,772
  • Rank 8,369 (Top 0.2 %)
  • Language
    HTML
  • Created over 12 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A lightweight, easy-to-use jQuery plugin for fluid width video embeds.

Introducing FitVids.js

A lightweight, easy-to-use jQuery plugin for fluid width video embeds.

FitVids automates the Intrinsic Ratio Method by Thierry Koblentz to achieve fluid width videos in your responsive web design.

How Do I Use It?

Include jQuery 1.7+ and FitVids.js in your layout and target your videos container with fitVids().

<script src="path/to/jquery.min.js"></script>
<script src="path/to/jquery.fitvids.js"></script>
<script>
  $(document).ready(function(){
    // Target your .container, .wrapper, .post, etc.
    $("#thing-with-videos").fitVids();
  });
</script>

This will wrap each video in a div.fluid-width-video-wrapper and apply the necessary CSS. After the initial Javascript call, it's all percentage-based CSS magic.

Currently Supported Players

YouTubeY
VimeoY
Blip.tvY*
ViddlerY*
Kickstarter Y*

* means native support for these may be deprecated. If your video platform is not currently supported, try adding it via a customSelector...

Add Your Own Video Vendor

Have a custom video player? We now have a customSelector option where you can add your own specific video vendor selector (mileage may vary depending on vendor and fluidity of player):

  $("#thing-with-videos").fitVids({ customSelector: "iframe[src^='http://mycoolvideosite.com'], iframe[src^='http://myviiids.com']"});
  // Selectors are comma separated, just like CSS

Note: This will be the quickest way to add your own custom vendor as well as test your player's compatibility with FitVids.

Ignore With Class

Have a video you want FitVids to ignore? You can slap a class of fitvidsignore on your object or container and your video will be displayed as it is defined.

If you'd like to add a custom block to ignore FitVids, use the ignore option.

  $("#thing-with-videos").fitVids({ ignore: '.mycooldiv, #myviiid'});
  // Selectors are comma separated, just like CSS

Target Videos embedded without classes or containers

Customers/clients will occasionally add a video to a general content area or article and this may be without a class or container that you're targetting. A solution to this is to target the parent of videos, using something like the below;

  $('iframe[src*="youtube"]').parent().fitVids();
  // You can change the selector to suit potential video providers, or chain them if your customer is likely to use more than one provider

By targetting the iframe/embed parent you can then dynamically add in the fitVids special sauce on the fly without needing to know the container ahead of time.

Known issues

  • Vimeo Autoplay API is not compatible with FitVids in IE11. You must manually wrap videos you want to autoplay.

More Repositories

1

FitText.js

A jQuery plugin for inflating web type
HTML
6,769
star
2

Lettering.js

A lightweight, easy to use Javascript <span> injector for radical Web Typography
JavaScript
5,393
star
3

awesome-standalones

A curated list of awesome framework-agnostic standalone web components
1,183
star
4

Foldy960

A responsive version of the 960 grid, the Pvel way!
CSS
483
star
5

TimeJump

TimeJump – Deep-links for Podcasts
JavaScript
348
star
6

can-i-subsystem-it

313
star
7

deCSS3

A lil' bookmarklet that will strip out your CSS3 rules and show you how gracefully you're degrading.
JavaScript
311
star
8

podcast-player

An audio web component for podcasts
117
star
9

a11y-nutrition-cards

Nutrition Cards for Accessible Components
HTML
90
star
10

htmlwithsuperpowers

A guidebook to Web Components
84
star
11

Better-Art-Direction

A fork of the incredible Art Direction plugin by NoΓ«l Jackson (http://noel.io).
PHP
77
star
12

fitWeird

A window monitor bookmarklet.
JavaScript
63
star
13

WP-Dribbble

A wordpress plugin and widget that pulls in your latest Dribbble shots.
PHP
54
star
14

fit-vids

Web Component version of FitVids from the creator of FitVids
JavaScript
35
star
15

Borkers

HTML5 Boilerplate + Starkers = Borkers! A starter theme.
PHP
22
star
16

humans-vs-robots

An unpacked chrome extension for Github
JavaScript
19
star
17

wobbly-box

A web component for drawing wobbly boxes
JavaScript
16
star
18

alpha-paintlet

A CSS Paint worklet that converts alpha's your bg-color based on some variables.
HTML
14
star
19

NodebotUI

Twitter Bootstrap for Nodebot Interfaces
JavaScript
14
star
20

sortByData

A simple jQuery plugin that lets you sort a collection of elements by any data- attribute you want.
JavaScript
5
star
21

2x

A chrome extension for speedier HTML Media
JavaScript
5
star
22

worker-controller

JavaScript
4
star
23

html-with-superpowers

HTML
4
star
24

htmlwithsuperpowers-deck

Vue
4
star
25

FitGrid

3
star
26

api-screenshot

JavaScript
2
star
27

jekyll-reduced-test-case

Ruby
1
star
28

jekyll-polymer

HTML
1
star
29

davatron5000

1
star
30

12th-Street-Bakery

A non-profit bakery teaching at-risk teens the art and skill of baking.
HTML
1
star
31

begin-graphql-test

Begin app
JavaScript
1
star