scrolly-gif

View on Github

Installation

$ npm install scrolly-gif

Usage

// place an image tag on the page like this:
// < img class="gif-example" src="preview.png" rel:animated_src="example.gif" />
 
// example with jQuery
// Pass the dom element to scrollyGif however
// is convenient for you.
var scrollyGif = require('scrolly-gif');
 
$('img.gif-example').each(function() {
  scrollyGif(this);
});

Introduction

This library will automatically animate a gif as a user scrolls through the page. The animation starts when the gif fully enters the viewport and ends when it exits. Scroll down to see examples below. All gifs were found on http://publicdomaingifs.tumblr.com/.