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

@jankocian/flowsnip-better-background-video

v1.1.2

Published

A better background video module for Webflow.

Downloads

12

Readme

flowsnip–better-background-video

Overview

This project improves native Background Video element in Webflow:

  • It enhances the autoplay experience on mobile devices with autoplay disabled. The video element is hidden before the playback stars, avoiding the ugly default UI (large play button), while attempting to autoplay the video when the user interacts with the page.
  • Also adds a smooth fade-in animation on playback start for all videos.
  • Is configurable via data attributes.

Problem

When background videos are embedded in a web page, videos do not autoplay in power-saving mode and a large default play button appears (often not clickable, because we're autoplaying a background video), cluttering the interface, negatively affecting the overall design & user experience.

Also, it often takes a while before the video playback, causing a "jumpy" feeling when the video finally starts.

Solution

  • When there is an autoplaying video that is paused, we add an event listener to the page, waiting for a click event. When the user interacts with the page, the video will play (iOS only accepts clicks within the area of the video element itself).
  • When the video is not yet playing, we hide it and display the poster image, so that the ugly default play button never appears.
  • On playback start, the video element element gets is-playing class, which is used for the default fade-in animation, or can possibly be used to add custom CSS animations.

How to Use

Embedding the Script

Site settings > Custom Code > Head code

<script src="https://cdn.jsdelivr.net/npm/@jankocian/[email protected]" async></script>

Basic Usage

No further setup is needed. By default, the autoplay will be taken care of, as well as the fade-in animation.

Configuration

On the Background Video module settings, you can add the following data attributes:

  • data-no-poster - Don't use the default video poster image, that Webflow generates aka. keep the video transparent until the playback starts. Allows you to use a custom poster image – just add an image to your markup so that is displayed beneth the video element.
  • data-no-fadein - Don't use the default styling that hides the video before playback and animates it in. It's up to you then to handle the css, if you want – you can still make use of the is-playing class to add custom animations.

This project was bootstrapped with Finsweet Developer Starter.