Tumblr-like Sticky Video Plugin With Pure JavaScript

Category: Javascript | March 12, 2018
Authorafuggini
Last UpdateMarch 12, 2018
LicenseMIT
Tags
Views1,245 views
Tumblr-like Sticky Video Plugin With Pure JavaScript

A pure JavaScript plugin which makes your videos (for example Youtube & Vimeo videos) and even any elements sticky at the of the bottom of the webpage when you scroll past them.

Similar to the Tumblr‘s sticky video function.

How to use it:

Include the following JavaScript and CSS files on the web page.

<link rel="stylesheet" href="css/sticky.css">
<script src="js/sticky_video.js"></script>

Embed a Youtube video into the sticky container.

<div id="sticky-container">
  <iframe class="sticky-container__object" src="https://www.youtube.com/embed/yMMz2VwbhVI?enablejsapi=1&amp;rel=0&amp;showinfo=0&amp;controls=0&autoplay=1" frameborder="0" height="270" width="480" allow="autoplay; encrypted-media"></iframe>
</div>

Initialize the StickyVideo library and done.

new StickyVideo('sticky-container')

You Might Be Interested In:


Leave a Reply