Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gif-stop

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gif-stop

Simply play and pause gifs

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gif-stop

Simply play and pause gifs

Installation

npm install gif-stop

gifStop([node|nodeList], [object])

Returns a GifStop object

imgs = document.getElementsByTagName('IMG');

// Play the gifs and stop after five seconds
gifs = gifStop(imgs, {
    playOn: 'click',
    onReady: function(gif){
        gif.play()
        setTimout(function(){
            gif.stop()
        }, 5000)
    }
});
imgs = document.getElementsByTagName('IMG');

gifs = gifStop(imgs)

// Plays all gifs
gifs.play()
// Stops all gifs
gifs.stop()
// Removes event handlers
gifs.destroy()

gifStop.setConfig([object])

OptionDefaulttypeDescription
playOnhoverstringWhether you want the gif played on hover or click. Can be set to hover or click.
classNamegif-playingstringThe class you want added to the image when it is playing.
onPlaynullfunctionThe function is called when the gif is played. It is passed a Gif object.
onStopnullfunctionThe function is called when the gif is stopped. It is passed a Gif object.
onReadynullfunctionThe function is called when the gif is loaded and ready to be stopped. It is passed a Gif object.

gifStop.gif([node], [object])

This takes similar options as gifStop and setConfig. The main difference is that you can only pass one gif.

OptionDefaulttypeDescription
classNamegif-playingstringThe class you want added to the image when it is playing.
onPlaynullfunctionThe function is called when the gif is played. It is passed a Gif object.
onStopnullfunctionThe function is called when the gif is stopped. It is passed a Gif object.
onReadynullfunctionThe function is called when the gif is loaded and ready to be stopped. It is passed a Gif object.

Contributing

  • The tests must pass
  • Run gulp before publishing to npm so the CoffeeScript will be compiled

Keywords

FAQs

Package last updated on 01 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc