Metrics
0
Watch 2 Star 22 Fork 2

yzChen / delaycallJavaScriptMIT

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
delaycall.js 修改表单延迟自动提交的 jQuery / Zepto 插件 spread retract

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

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

Comments ( 4 )

You need to Sign in for post a comment

Help Search