• Stars
    star
    415
  • Rank 104,301 (Top 3 %)
  • Language
    JavaScript
  • License
    Other
  • Created almost 12 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

Fluid width (responsive) videos module, 1KB, custom players, dynamic elements/XHR support.

fluidvids.js Build Status

Fluidvids is a 1KB standalone module that provides a fluid solution for video embeds. Fluidvids has the ability for custom players to be added as well as support for dynamically injected (XHR/Ajax/createElement) videos.

Live demo of fluidvids.

Methods

init()

Pass in your configuration. That's it.

fluidvids.init({
  selector: ['iframe', 'object'], // runs querySelectorAll()
  players: ['www.youtube.com', 'player.vimeo.com'] // players to support
});

selector

Type: Array Default: ['iframe']

Custom selector(s) that fluidvids will search for in the DOM and make fluid.

players

Type: Array Default: ['www.youtube.com', 'player.vimeo.com']

Internally constructs a strict RegExp which tells fluidvids which videos from specific domains to make fluid. This avoids any unwanted videos being parsed and adds developer flexibility.

render()

Provides dynamic video support. Using render() should only be done when you want to requery the DOM and look for newly added videos, such as document.createElement('iframe');. Fluidvids uses internal object caching to lookup init() configuration, so it's lightning fast.

// run after dynamic elements have been injected
// you'll need to run this each time you need it
fluidvids.render();

Installing with Bower

Use the repository hook:

bower install https://github.com/toddmotto/fluidvids.git

Installing with browserify

Use the repository hook:

npm install toddmotto/fluidvids

Then require fluidvids in your file:

// Note that it is called as a function
var fluidvids = require('fluidvids.js')();

Manual installation

Ensure you're using the files from the dist directory (contains compiled production-ready code). Ensure you place the script before the closing </body> tag.

<body>
  <!-- html above -->
  <script src="dist/fluidvids.js"></script>
  <script>
  // fluidvids module available
  </script>
</body>

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release history

  • 2.4.1
    • Fix bug for class names already existing on host element
    • Update Jasmine test accordingly
  • 2.4.0
    • Fix bug for comparing width/height attrs > 1000
    • Finish all unit tests
    • Move to Gulp
  • 2.3.0
    • Add support for videos where height > width
    • Multiple selector support and CSS change to unrestrict element type
    • Add npm entry point
    • Change apply() to render() for better naming
    • Use while loop for and improved loop perf
  • 2.2.0
    • XHR/Ajax content support via new apply() method to requery DOM
    • Add AMD support
  • 2.1.0
    • Fix IE8 bug
  • 2.0.0
    • Complete rewrite using Module pattern with public methods
    • Better ability to add custom players
    • Add a custom selector
  • 1.2.0
    • Make use of Prototypes
  • 1.1.0
    • Better structure
  • 1.0.0
    • Initial release

More Repositories

1

angularjs-styleguide

AngularJS styleguide for teams
5,965
star
2

echo

Lazy-loading images with data-* attributes
JavaScript
3,723
star
3

fireshell

Fiercely quick front-end boilerplate and workflows, HTML5, Grunt, Sass.
JavaScript
1,519
star
4

angular-1-5-components-app

A Contacts Manager application built on Angular 1.5 components, ui-router 1.0.0, Firebase.
JavaScript
573
star
5

flare

Unobtrusive event emitter API for Google Universal Analytics event tracking
JavaScript
505
star
6

angular-pizza-creator

Source code for Angular advanced Form APIs pizza builder
TypeScript
450
star
7

angular-dynamic-forms

Configurable Reactive Forms in Angular with dynamic components
TypeScript
317
star
8

angular-architecture

Angular architecture guide for teams.
262
star
9

apollo

Standalone cross-browser DOM class manipulation module
JavaScript
250
star
10

angular-component

Fully featured .component() polyfill for Angular v1.3+
JavaScript
191
star
11

reactive-pizza

Angular v4.1.1 - Reactive Forms, Observables, Component Architecture. Pizza. 🍕
TypeScript
180
star
12

axis

Simple JavaScript type checking module. Returns a Boolean for each type check.
JavaScript
179
star
13

superbox

Superbox, the lightbox, reimagined
JavaScript
125
star
14

flaunt-js

Flaunt JS, stylish responsive navigations with nested click to reveal
CSS
89
star
15

linkjuice

Automatically wraps and creates anchor links for <h1-h6> headings
JavaScript
88
star
16

foreach

forEach implementation for Objects/NodeLists/Arrays, automatic type loops and context options
JavaScript
81
star
17

lunar

SVG class module for has/add/remove/toggleClass
JavaScript
78
star
18

stratos

Object manipulation module, simplified extends, keys, add/remove methods and more.
JavaScript
72
star
19

interpolate

Micro templating engine, maps Object property values to a String template
JavaScript
56
star
20

console.loge

Doge-driven debugging. Such console, many logs. Wow.
JavaScript
47
star
21

jbar

jBar, the lightweight jQuery notification banner.
CSS
32
star
22

superfast-angular-2

A super simple setup for Angular 2 to prototype or play around. Components, TypeScript and Routing.
JavaScript
32
star
23

gulp-oss

My Gulp.js boilerplate for creating new JavaScript projects
JavaScript
28
star
24

NoFi

No WiFi, detecting offline states with HTML5
JavaScript
25
star
25

switch-messages

switchMessages for Angular 1.2+, partial functionality from Angular 1.3+ "ngMessages"
JavaScript
24
star
26

fluidvids-react

React.js implementation of fluidvids.js
JavaScript
23
star
27

track-digests

A simple Directive to track $digest counts
JavaScript
21
star
28

psswrd

Show/hide toggling for password inputs.
JavaScript
21
star
29

ac-store

Simple Redux Store
TypeScript
19
star
30

angular-connect-2016

Final code for AngularConnect Angular 1 & 2 demos.
HTML
18
star
31

suave

Re-engineering the HTML5 <video> tag for semantics and modularity.
JavaScript
16
star
32

ac-boilerplate

TypeScript
15
star
33

mapify

Map iteration for Arrays and Objects
JavaScript
14
star
34

fluidvids-polymer

Web Component for fluidvids.js built with Polymer
14
star
35

ngrx-workshop

JavaScript
12
star
36

data-tabs

Simple HTML5 data-* jQuery tabs. Markup free and relative to their container for ultimate re-use.
12
star
37

workspaces-grunt

Using Grunt and Chrome Workspaces for in-browser development
JavaScript
10
star
38

fowa2014

FOWA 2014 workshop
CSS
7
star
39

ngWorkshop2015

[this is really old, wouldn't bother using it] Falsy Values AngularJS Workshop 2015
JavaScript
5
star
40

babel-private-properties-methods-classes

🔥 Babel + ESLint + Private Properties and Methods in Classes
5
star
41

imgShufflr

jQuery random image shufflr, inline img and background CSS
5
star
42

ngbe-2016

Source code moved here: https://github.com/toddmotto/angular-pizza-creator
5
star
43

selectnav

JavaScript select navigation for responsive projects
JavaScript
4
star
44

fitdevcomments

3
star
45

aot-loader

[BETA/Work In Progress] Ahead-of-Time Compiler for Webpack.
JavaScript
3
star
46

web-platform-angular-2

HTML
3
star
47

required-fallback

A robust HTML5 'required' attribute fallback, client-side jQuery script.
3
star
48

bounceThis

jQuery plugin that mimics CSS3 keyframes animations of bouncing headers
JavaScript
2
star
49

kendo-html-editor

HTML
2
star
50

fowd

CSS
1
star