Skip to content

freezeframe.js is a script that pauses animated .gifs and enables them to animate on mouse hover / mouse click / touch event, or with trigger / release functions. It supports responsive images and works as a jQuery plugin.

License

Notifications You must be signed in to change notification settings

pweigand/freezeframe.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

freezeframe.js

freezeframe.js is a script that pauses animated .gifs and enables them to start animation automatically on mouse hover / mouse click / touch event, or manually withg trigger / release functions. it also supports responsive images.

Examples

http://ctrl-freaks.github.io/freezeframe.js/

Basic Usage

  1. Include the js and css from /build

    <link rel="stylesheet" href="freezeframe_styles.min.css">
    <script src="freezeframe.min.js"></script>

    If you do not use a packaged version the following dependencies are required
    ( can be found in /src/js/vendor ):

  2. Add freezeframe as a class name on the .gifs you want processed

    <img class="freezeframe" src="image.gif" /> 
    

Add freezeframe-responsive as an additional class name to make the .gif responsive <img class="freezeframe freezeframe-responsive" src="image.gif" />

  1. ✨ freeze those frames ✨

    $(function() {
      ff = new freezeframe().freeze();
    })

Advanced Usage

freezeframe.js exposes public methods to allow for more custom integration. These methods are described in detail in the Function Reference

You can manually trigger freezeframe functions to do whatever you want in whatever order you want.

You have the option of manually going through the steps with freezeframe to setup, capture images, process images, attach event handlers, and trigger

Capture and manually trigger / release animation

logo = new freezeframe('#logo'); // setup freezeframe instance with custom selector

logo.capture(); // capture images by selector
logo.setup();   // setup helper elements
logo.process(); // process images so they are paused
logo.trigger(); // trigger animation
logo.release(); // release animation

Options Reference

Options can be passed to a freezeframe instance on creation in the form of an object or a string. Strings will be interpreted as the selector option.

// object as options
ff = new freezeframe({
  'selector': '.my_class',
  'animation_play_duration': 3000,
  'non_touch_device_trigger_event': 'hover'
})

// string as selector option
ff = new freezeframe('.my_class')

selector string
this is something something show default value

animation_play_duration integer
this is something something show default value

non_touch_device_trigger_event string
this is something something show default value

Function Reference

these are the freezeframe public methods and how you can use them

  • freezeframe() creates a new freezeframe object with image selection. can be passed options object or string to act as new selector.

  • capture()

  • setup()

  • process()

  • filter()

  • trigger()

  • release()

Development Environment

  • use package.json to install npm stuff
  • list gulp commands to build the project
  • cleanup gulpfile

About

freezeframe.js is a script that pauses animated .gifs and enables them to animate on mouse hover / mouse click / touch event, or with trigger / release functions. It supports responsive images and works as a jQuery plugin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.4%
  • CSS 1.6%