2 Star 19 Fork 2

yzChen / delaycall

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.89 KB
一键复制 编辑 原始数据 按行查看 历史
yzChen 提交于 2016-09-21 23:25 . 完善readme

delaycall.js

delaycall.js 是一个 jQuery / Zepto 插件,用于在用户完成某项操作后,延迟指定秒数后自动调动指定函数。如用户输入完内容后,延迟1秒,自动提交表单。

delaycall.js is a jQuery / Zepto plug-in, for the user to complete an operation, the number of seconds after the specified number of seconds automatically adjust the specified function. If the user input after the end of the content, delay one second, automatically submit the form.

GitHub Repository

https://github.com/yzchen0o0/delaycall

git@OSC Repository

http://git.oschina.net/cyzshenzhen/delaycall

Demo

点击查看在线演示地址

Click to view online demo

Quick Start Guide

include

<script src="./jquery-1.11.3.js"></script>
<script src="./delaycall.js"></script>

JavaScript

function foo() {
    alert('保存成功!');
}

$(function() {
    $('input').delaycall({
    'func': foo,               // 必填,函数名称
    'times': 1000,             // 选填,延迟时间,单位:毫秒
    'beforeCallClear': true,   // 选填,未执行func前,绑定事件被触发,是否清理之前定义的定时器
    'event': 'blur',           // 选填,触发事件,默认是离开焦点时触发,依据jquery/zepto语法,如 keydown ...
    'justNormalKeyCode': true  // 选填,event -> keydown 时,是否只支持普通按键:英文、数字
    });
});

Html

修改标题:<input id="s1"/>&nbsp;&nbsp;修改内容:<input id="s2"/>

My Blog

blog.chenyuanzhen.com

JavaScript
1
https://gitee.com/cyzshenzhen/delaycall.git
git@gitee.com:cyzshenzhen/delaycall.git
cyzshenzhen
delaycall
delaycall
master

搜索帮助