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=" ...
随机推荐
- phpcms图片模型调用组图的问题
phpcms里面有个图片模型,之前一直没有用过,之前用的轮播图是用文章+缩略图+推荐位实现的 今天看了一下图片模型添加内容的地方,和平常的文章相比多了一个组图的地方:
- 【GoLang】GoLang struct 使用
代码示例: package main import "fmt" type Human struct { name string age int weight int } type ...
- Function接口 – Java8中java.util.function包下的函数式接口
Introduction to Functional Interfaces – A concept recreated in Java 8 Any java developer around the ...
- 手动安装python后,交互模式下退格键乱码
没有安装readline相关的模块 yum install readline readline-devel 再重新变异安装python就可以了
- ZPF MYSQL数据库链接层
2015年3月31日 18:27:34 最后编辑: 2016年4月17日 00:22:00 星期日 读写分离: 根据最终的sql语句来判断是读还是写 (随后会考察并加上一致性哈希) 链式调用: 参看 ...
- FastReport报表对象介绍一:“Text”对象
FastReport中文网 http://www.fastreportcn.com/Article/70.html ------------------------------------------ ...
- c# 获取系统版本,获取net framework 版本(Environment 类)
1.获取当前操作系统版本信息 使用Environment.OSVersion 属性 获取包含当前平台标识符和版本号的 OperatingSystem 对象. 命名空间: System程序集: ms ...
- iOS-UIView 之 layoutMargins & preservesSuperviewLayoutMargins 解惑
这里先看下苹果给出的解释: iOS8.0之后,uiview默认layoutMargins 为(8,8,8,8),也可以自己指定,仅适用于自动布局:当添加子view到父view上时,这样设置好约束 默认 ...
- JS 异步加载的方法
(1) defer,只支持IE : <script type="text/javascript" defer="defer"> </scrip ...
- WebFrom 的js日期控件
1.WdatePicker.js /* * My97 DatePicker 4.7 Release * License: http://www.my97.net/dp/license.asp */ v ...