Code Monkey home page Code Monkey logo

gifplayer's Introduction

GIF图片播放/暂停

本项目参考自Rubén Torres的Gifplayer项目https://github.com/rubentd/gifplayer

1.介绍

我们在浏览一些具有逻辑性的GIF动图时,往往希望GIF可以暂停,留下我们思考的时间。不然就会出现如下情景:

卧槽!等等!慢点啊!还没想明白上一步在干嘛呢!是不是比较崩溃?这时候如果可以随时控制GIF暂停播放,是不是就爽多了,比如下面这样:

有人可能会问,直接用视频格式不就行了吗?确实,用视频肯定行,但是有些步骤本来就比较少,用视频就有点杀鸡用牛刀的感觉了...

2.使用

引入css文件

<link href="css/gifplayer.min.css" rel="stylesheet" />

引入js文件

<script src="js/gifplayer.min.js" type="text/javascript"></script>

使用GIF图片

使用img标签,GIF路径写到data-src属性中。

<img data-src="images/2.gif"/>

注:文件路径视自己实际项目路径而定

3.显示效果

GIF图片处理后,会在图片中上方显示一个暂停\播放图标,可以点击该图标实现GIF的暂停与播放。效果如下:

希望对你有点帮助哦!

gifplayer's People

Contributors

sherlonwang avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Forkers

fakegit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.