jQuery实现长按按钮触发事件的方法
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery.min.js"></script> </head> <body>
<div id="mydiv" style="width:100px; height:100px; background:#ddd;">长按2秒执行其他事件</div>
</body>
</html> <script> var timeout ; $("#mydiv").mousedown(function() {
timeout = setTimeout(function() {
$("#mydiv").text("执行到其他事件");
}, 2000);
}); $("#mydiv").mouseup(function() {
clearTimeout(timeout);
$("#mydiv").text("长按2秒执行其他事件");
}); $("#mydiv").mouseout(function() {
clearTimeout(timeout);
$("#mydiv").text("长按2秒执行其他事件");
}); </script>

jQuery实现长按按钮触发事件的方法的更多相关文章
- js点击按钮触发事件的方法
<!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <input id= ...
- jquery easyui combobox 级联及触发事件,combobox级联
jquery easyui combobox 级联及触发事件,combobox级联 >>>>>>>>>>>>>>&g ...
- jquery单选框radio绑定click事件实现方法
本文实例讲述了jquery单选框radio绑定click事件实现方法.分享给大家供大家参考. 具体实现方法如下: 复制代码代码如下: <html><head><title ...
- jquery实现input输入框实时输入触发事件代码 ---jQuery 中bind(),live(),delegate(),on() 区别
复制代码 代码如下: <input id="productName" name="productName" value="" /> ...
- jQuery实现按Enter键触发事件?
按Enter触发 $(function(){ document.onkeydown = function(e){ var ev = document.all ? window.event : e; ) ...
- webform中按钮触发事件顺序
执行顺序 先执行js端的方法,后执行后台的方法 一般js端方法用做数据的校验,校验成功 return true;后才执行后台的方法. 示例 <asp:Button runat="ser ...
- jQuery实现按Enter键触发事件
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8& ...
- jquery点击元素之外触发事件
$("#errorMsg_layer").bind("click",function(e){ if($(e.target).closest("#err ...
- jquery实现input输入框实时输入触发事件代码
<input id="productName" name="productName" class="wid10" type=" ...
随机推荐
- 自带openJDK,如何切换成Oracle JDK
1.去Oracle官网下载最新的jdk,解压,配置环境变量(直接改 /etc/profile) 参考:http://www.cnblogs.com/aaronhoo/p/5293118.html 2. ...
- git分支的合并
原文: http://gitbook.liuhui998.com/3_3.html http://gitbook.liuhui998.com/5_3.html 一.如何分支的合并 在git中,可以使用 ...
- Alien Dictionary
There is a new alien language which uses the latin alphabet. However, the order among letters are un ...
- Ubuntu里面软件的安装与卸载
在Ubuntu里面,有时候碰到软件配置错了,这是重新再安装的话,会检测到已安装,系统不会再重新安装,就需要卸载之后重装 1.通过deb包安装的情况: 安装.deb包: 代码:sudo dpkg -i ...
- [转载]Python-第三方库requests详解
Requests 是用Python语言编写,基于 urllib,采用 Apache2 Licensed 开源协议的 HTTP 库.它比 urllib 更加方便,可以节约我们大量的工作,完全满足 HTT ...
- iOS self = [super init]
self = [super init] 这个问题一直不太明白,今天研究了一下,在stackoverflow找到了下面的答案: http://stackoverflow.com/questions/29 ...
- Nginx反向代理到Tomcat服务器
在实际生产中,Tomcat服务器一般不单独使用在项目中,对于静态资源的响应Nginx表现的比较好,另外由于nginx是专门用于反向代理的服务器,所以很容易实现将java的请求转发到后端交给tomcat ...
- nyoj_299_Matrix Power Series_矩阵快速幂
Matrix Power Series 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 Given a n × n matrix A and a positive i ...
- BestCoder27 1001.Jump and Jump... (hdu 5162) 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5162 题目意思:有 n 个 kid,每个 kid 有三个成绩 a, b, c.选最大的一个成绩作为这个 ...
- 【hadoop2.6.0】利用Hadoop的 Java API
Hadoop2.6.0的所有Java API都在 http://hadoop.apache.org/docs/r2.6.0/api/overview-summary.html 里. 下面实现一个利用J ...