npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iframe-video-overlay

v1.0.5

Published

Simple embed responsive video(YouTube, Vimeo, Daily Motion, Coub) overlay module.

Downloads

13

Readme

Simple embed responsive video(YouTube, Vimeo, Daily Motion, Coub) overlay module.

Example

https://codepen.io/mickyholbrook/pen/yLYvNEr


Installation

npm

npm i iframe-video-overlay

Load the required JS to your entry JS file:

let IFrameVideoOverlay = require('iframe-video-overlay');   
or    
import IFrameVideoOverlay from 'iframe-video-overlay';

Load the required stylesheet to your entry CSS file:

@import "node_modules/iframe-video-overlay/index";

Cloning git repository

1. Go to your project directory
2. git clone https://github.com/dmitriyakkerman/iframe-video-overlay.git .

Put the required stylesheet link in HEAD tag:

<link rel="stylesheet" href="./dist/css/iframe-video-overlay.min.css">
 

Put the script at the bottom of your markup:

<script src="./dist/js/iframe-video-overlay.min.js"></script>    

Usage

Create root element, specify video ID inside "data-id" attribute.

<div class="video" data-id="lM02vNMRRB0"></div>

Youtube video ID

Vimeo video ID

Daily Motion video ID

Coub video ID


Initialization

1.Specify root element (string or DOM node) in "el" option.

2.Specify video hosting name("youtube" or "vimeo" or "dailymotion" or "coub") in "type" option.
*You can pass this option in case using youtube video(option "type" has "youtube" value by default).

3.Specify "imageSrc" if you want to overlay iframe with image.

4.Specify "iconSrc", "width", "height" and "percentage" options inside "playButton" option for play button customization.
*You can pass "width" and "height" options in case using "percentage" option(or even pass "percentage" option, by default "width" and "height" equal "10%" of root element)

  document.addEventListener('DOMContentLoaded', function() {
      new IFrameVideoOverlay({
          el: '.video',
          type: 'youtube', //or 'vimeo' or 'dailymotion' or 'coub'
          imageSrc: 'video-image.jpg',
          playButton: {
              iconSrc: 'play-button.png',
              width: '15%',
              height: '15%',
              //or
              percentage: 20
          }
      })
  });

Options

el

Root element for module initialization.

Type: String, Element
Required: true

type

Points of what type of the video hosting you are going to use.

Type: String
Default: youtube
Required: false

imageSrc

Background image, which covers your iframe video.

Type: String
Required: false

playButton

Play button customization property, which includes playButton.iconSrc, playButton.width, playButton.height and playButton.percentage options.

Type: Object
Required: true

playButton.iconSrc

Play button icon.

Type: String
Required: true

playButton.width

Width of play button.

Type: String(px, %, etc...)
Default: playButton.percentage or 10% of root element
Required: false

playButton.height

Height of play button.

Type: String(px, %, etc...)
Default: playButton.percentage or 10% of root element
Required: false

playButton.percentage

Width and height of play button in percentage.

Type: Number
Default: 10% of root element
Required: false