您的位置:首页 > 其它

实现鼠标单击双击响应

2015-03-23 11:21 267 查看
网站来源:http://benalman.com/projects/jquery-dotimeout-plugin/

 示例

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title><!--http://www.cssrain.cn/demo/jquery-ui-tab/jquery-1.3.1.js http://banu.blog.163.com/blog/jquery.do-timeout.js  http://banu.blog.163.com/blog/jquery.JS--> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/JAVAscript" src="jquery-1.4.2.js"></script>
<script type="text/javascript" src="jquery.ba-dotimeout.js"></script>
<script>
$(function(){
var default_text = $('p.textfield').text();
$('form input').keyup(function(){
$(this).doTimeout( 'typing', 2000, function(){
$('#text-input').text( $(this).val() || default_text );
});
});
});
</script>
</head>
<body>
<p id="text-input">biuuu.com</p>
<form action=''>
<input type="text" name="whatever">
</form>

</body>
</html>

 

 

方法参数解释:

参数1.

typing :是dotimeout方法的身份标示,当同一个函数使用一个以上dotimeout方法时此参数不能相同才能保证两个方法同时执行,如果相同则只执行最后一个.

参数2.

5000 : 这个不用多说了 是dotimeout的执行毫秒数,1000毫秒等于一秒

参数3.

function(){......} :这个是多少秒后所执行的函数,函数内自己研究写什么吧 嘿嘿

 

上面的网站上还有几个参数 具体不知道做什么的了 有高手的话可以帮我研究研究 告诉我一声 我也学习学习

个人观点 我希望大家不要只顾着自己学习 也多在网站上分享一下 你们的知识 这样网络上的编程知识才能壮大

让更多的新人也更容易学习 因为我们是做网络的 我们本身在网络上查的也方便 还能让新人更好的学习 何乐而不为呢

 

让网络变成所有人最好的学习地点 无论学什么

 

Release v1.0

Tested with jQuery 1.3.2 and jQuery 1.4.2 in Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.

Download Source, Minified (1.0kb)

Follow the project on GitHub project page or report a bug!

View Full Documentation

View Unit Tests

Examples: Debouncing, Delays & Polling Loops, Hover Intent
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: