Code Monkey home page Code Monkey logo

loadbar's Introduction

loadBar

npm (scoped)

一个漂亮,强大的进度条插件。监听http请求的状态,并且直观的展示Http请求进度。

简体中文 | English

Docs/演示文档

启动

npm run dev

构建生产

npm run build

使用

使用 npm:

npm i @onaug6th/load-bar

使用script标签:

<script src="/dist/loadBar.min.js"></script>

例子

页面中先引入jquery,然后再引入loadBar.min.js。

$("body").loadBar();

var options = {...}
$("#other").loadBar(options);

options 配置

var opt = {
    displayOnRequest: false,
    height: 200,
    endLoad: function(){
        //  do sth
    }
}
$("body").loadBar(opt);
名称 说明 类型 默认值
displayOnRequest 是否在请求中展示 Boolean true
background 进度条背景色 String #29d
img 是否使用图片 String
height 进度条高度 Number, String 2px
all 任何事件都会触发 Function noop
startLoad 进度条出现前触发 Function noop
endLoad 进度条消失后触发 Function noop
mounted 进度条挂载后触发 Function noop

事件

$("body").on("startLoad", function(){
    //  do sth
})
名称 说明 类型
all 任何事件都会触发 Function
startLoad 进度条出现前触发 Function
endLoad 进度条消失后触发 Function
mounted 进度条挂载后触发 Function

方法

$("body").loadBar("start");
//  or
$("body").loadBar("getOpt", "img");
//  or
$("body").loadBar("setOpt", "img", yourPath);
名称 说明 参数
start 进度条开始
end 进度条结束
setOpt 设置进度条配置属性 attrName: String Object, value: String
getOpt 获取配置属性 attrName: String
destroy 摧毁进度条
sayName 打招呼 name:string

License

MIT

have a nide day

loadbar's People

Contributors

onaug6th avatar pingtest avatar

Stargazers

entimm avatar Rhodri Cheung avatar  avatar  avatar 刘振文 avatar 小游 avatar  avatar ChenSen avatar  avatar

Watchers

 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.