GithubHelp home page GithubHelp logo

sisihuisi / progress-indicator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mqyqingfeng/progress-indicator

0.0 1.0 0.0 8 KB

仿阮一峰老师的《ECMAScript 6 入门》的顶部进度条

JavaScript 100.00%

progress-indicator's Introduction

progress-indicator

仿阮一峰老师的《ECMAScript 6 入门》的顶部进度条

介绍

原生 JavaScript 实现的顶部进度条,兼容到 IE7+。

效果演示:https://mqyqingfeng.github.io/progress-indicator/

兼容性

IE7+

下载

git clone git@github.com:mqyqingfeng/progress-indicator.git

使用

<script src="path/progress-indicator.js"></script>

或者

import ProgressIndicator from 'path/progress-indicator.js'

示例

直接使用:

new ProgressIndicator();

绑定事件:

var progressBar = new ProgressIndicator();

progressBar.once("end", function(){
    alert('恭喜您已经阅读完毕')
})

API

初始化

var progressBar = new ProgressIndicator(options);

options

1. color

默认值为 "#0A74DA"

示例:

var progressBar = new ProgressIndicator({
    color: "#e74c3c"
});

事件

1. end 事件

进度到达 100% 时触发 end 事件。

使用 on 可绑定 end 事件的监听函数。

progressBar.on("end", function(){
    alert('恭喜您已经阅读完毕')
})

使用 once ,监听函数只被触发一次。

progressBar.once("end", function(){
    alert('恭喜您已经阅读完毕')
})

progress-indicator's People

Contributors

mqyqingfeng avatar

Watchers

James Cloos avatar

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.