Retour au classement

nnx0r/vidage

JavaScriptdvlden.github.io/vidage/

Your solution to full-screen background video & image combined.

backgroundvideobackground-videohacktoberfest
Croissance des étoiles
Étoiles
1.6k
Forks
70
Croissance hebdomadaire
Issues
1
1.6k
18 juil.19 juil.20 juil.20 juil.
Artefactsnpmnpm install vidage
README

Vidage

This JS module will treat video as a background. It will determine when to hide/show & pause/play the video. Touch devices and/or smaller devices with width of 34em will display image provided as fallback.

Installation (pick one)

  • npm i @dvlden/vidage
  • pnpm i @dvlden/vidage
  • yarn add @dvlden/vidage

CDN (pick one)

  1. JSDelivr
  2. UNPKG

Usage

Preferred way...

Add base structure and replace video source paths

<div class="vidage">
  <video id="vidage" class="vidage-video" preload="metadata" loop autoplay muted>
    <source src="videos/bg.webm" type="video/webm">
    <source src="videos/bg.mp4" type="video/mp4">
  </video>
</div>

Setup and import required styles

// set the fallback-cover image
$vdg-fallback-image: url('../images/fallback.jpg');

// import package
@import '~vidage/src/styles/vidage';

Import the JS module and create new instance

import Vidage from 'vidage'

new Vidage('#vidage')

Old fashioned way...

Below you will find complete html example...

<!doctype html>
  <html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Document</title>

    <link rel="stylesheet" href="dist/vidage.css">
    <style>
      /* Override the cover image. Set the path to the actual image... */
      .vidage::before {
        background-image: url('images/fallback.jpg');
      }
    </style>
  </head>

  <body>
    <div class="vidage">
      <video id="vidage" class="vidage-video" preload="metadata" loop autoplay muted>
        <source src="videos/bg.webm" type="video/webm">
        <source src="videos/bg.mp4" type="video/mp4">
      </video>
    </div>

    <!-- START: Rest of your site content -->
    ...
    <!-- END: Rest of your site content -->

    <script src="dist/vidage.js"></script>
    <script>
      new Vidage('#vidage')
    </script>
  </body>
</html>

JS Arguments

Instance of Vidage accepts two arguments. First argument is the actual selector of the video, that instance will control. Second argument is the actual object for the options.

Argument Required Type
selector string/node
options object
Key Default Value Required Type
helperClass vidage-ready string
videoRemoval false bool

SCSS Variables

Variable Default Value
$vdg-fallback-image url('../images/cover.jpg')

Browser Support

Yet to be determined. All modern browsers should be alright.

Dépôts similaires
tengbao/vanta

Animated 3D backgrounds for your website

JavaScriptnpmMIT License3dthreejs
vantajs.com
6.7k1.1k
christianloopp/komorebi

A beautiful and customizable wallpapers manager for Linux

ValaGNU General Public License v3.0desktoplinux
3.7k257
cheesecakeufo/komorebi

A beautiful and customizable wallpapers manager for Linux

ValaGNU General Public License v3.0desktoplinux
3.5k245
alewin/useWorker

⚛️ useWorker() - A React Hook for Blocking-Free Background Tasks

JavaScriptnpmMIT Licensereacthooks
useworker.js.org
3.1k106
megh-bari/pattern-craft

Professional-grade background patterns and gradients for your websites and apps. Easily copy and paste into your next project. Crafted with modern CSS and Tailwind for seamless integration.

TypeScriptnpmMIT Licensebackgroundbackground-snippets
patterncraft.store
3k228
coreybutler/node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).

JavaScriptnpmOtherdaemonnode-windows
2.9k366
transistorsoft/react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection

TypeScriptnpmMIT Licensereact-nativebackground-location
shop.transistorsoft.com/pages/react-native-background-geolocation
2.9k445
gotev/android-upload-service

Easily upload files (Multipart/Binary/FTP out of the box) in the background with progress notification. Support for persistent upload requests, customizations and custom plugins.

KotlinApache License 2.0uploadservice
2.9k702
itmeo/webgradients

180 linear gradients in CSS3, Figma, Sketch and PSD formats — free for personal and commercial use

CSSnpmMIT Licensegradientbackground
webgradients.com
2.5k141
ibelick/background-snippets

Modern background snippets: copy, paste, ready-to-use

TypeScriptnpmbackgroundcss
bg.ibelick.com
2k89
shalldie/vscode-background

Bring background images to your vscode. vscode background 背景扩展插件。

TypeScriptnpmMIT Licensevscodevscode-background
marketplace.visualstudio.com/items
1.9k162
dvlden/vidage

Your solution to full-screen background video & image combined.

JavaScriptnpmMIT Licensebackgroundvideo
dvlden.github.io/vidage/
1.6k70