Coder Social home page Coder Social logo

alaahd / fluidvids Goto Github PK

View Code? Open in Web Editor NEW

This project forked from toddmotto/fluidvids

0.0 2.0 0.0 425 KB

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

Home Page: http://toddmotto.com/labs/fluidvids

License: Other

fluidvids's Introduction

Fluidvids.js Build Status

Fluidvids is 1KB standalone module that provides a fluid solution for video embeds. By default, fluidvids supports YouTube and Vimeo - but you can easily add your own players. Fluidvids also provides support for dynamically injected (XHR/Ajax/createElement) videos.

Check out a demo of fluidvids. Also available as a WordPress plugin.

Methods

init()

Pass in your configuration.

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

Fluidvids internally constructs a strict Regular Expression which obides by your players Array, so ensure any new videos you add are added to players: []. This helps avoid any unwanted videos being parsed and provides flexibility for scaling easily.

apply()

Provides dynamic video support. Using apply() 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.apply();

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')();

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.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

fluidvids's People

Contributors

toddmotto avatar jaydenseric avatar iamlacroix avatar

Watchers

James Cloos avatar Alaa Hadad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.