Giter Site home page Giter Site logo

landsurveyorsunited / superembed.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from corbindavenport/superembed.js

0.0 2.0 0.0 29 KB

Fluid width for YouTube, Vimeo, Vine, VideoPress, DailyMotion, and more embedded videos.

License: GNU General Public License v3.0

JavaScript 100.00%

superembed.js's Introduction

SuperEmbed.js

Live demo now available at jsfiddle.net/8w7Lhtyt

SuperEmbed.js detects YouTube, Vimeo, Vine, VideoPress, DailyMotion, and more embedded videos on webpages and makes them responsive. Essentially, this means they strech to fill their container while still maintaining the original aspect ratio.

There's a lot of existing libraries that do this, but I had issues or just didn't like all the ones I tried, so I made my own. And this is it.

Features

  • Works without external libraries like JQuery
  • Works automatically with YouTube, Vimeo, Kickstarter, CollegeHumor, Hulu, Flickr, Vine, VideoPress, DailyMotion, Twitch.tv, and Vid.me embedded videos
  • Responsive layout can be forced or blocked with classes applied to the embed code
  • Extremely tiny, the minified version is only 1.65KB

How to use

You can put the SuperEmbed script wherever you want on the page:

<script src="superembed.min.js"></script>

Then it will automatically resize any supported embedded videos. That's it.

Advanced features

If you want to make an embedded video (or really any element) responsive and locked to a 16:9 ratio, but it's not automatically detected by SuperEmbed, you can add the .superembed-force class to it like this:

<iframe src="http://www.example.com/video" class="superembed-force"></iframe>

You can also tell SuperEmbed to not resize a specific embed by adding the .superembed-ignore class, like this:

<iframe src="http://www.example.com/video" class="superembed-ignore"></iframe>

And finally, you can force a 4:3 aspect ratio by adding the .superembed-square class, like this:

<iframe src="http://www.example.com/video" class="superembed-square"></iframe>

New in SuperEmbed.js 1.3:

  • Removed optional CSS calc() due to not working correctly

New in SuperEmbed.js 1.2:

  • Fixed issue with undefined error

New in SuperEmbed.js 1.1:

  • Added support for Vid.me and Twitch.tv
  • Vine embeds are now automatically 4:3 instead of 16:9
  • You can now add the .superembed-square class to force an embed to 4:3 ratio

New in SuperEmbed.js 1.0:

  • Initial release

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

superembed.js's People

Watchers

Justin Farrow avatar James Cloos 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.