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=" ...
随机推荐
- 数论v2
#include <cmath> #include <cstdio> #include <cstring> #include <algorithm> # ...
- xargs命令
xargs命令 常用工具命令 xargs命令是给其他命令传递参数的一个过滤器,也是组合多个命令的一个工具.它擅长将标准输入数据转换成命令行参数,xargs能够处理管道或者stdin并将其转换成特定命令 ...
- 【MySQL】MySQL server has gone away 怎么处理?
直接上代码: from django.db import connection ... def is_connection_usable(): try: connection.connection.p ...
- Sharepoint2013 中想要将网站另存为模板步骤
Sharepoint2013 中想要将网站另存为模板步骤 第一步:使用SPD打开想要另存为模板的网站,找到网站选项: 第二步:点击打开网站选项,找到一个SaveSiteAsTemplateEnable ...
- Appium根据xpath获取控件
如文章< Appium基于安卓的各种FindElement的控件定位方法实践>所述,Appium拥有众多获取控件的方法.其中一种就是根据控件所在页面的XPATH来定位控件. 本文就是尝试通 ...
- echo 单引号和双引号
echo输出 $key=value echo "$key" echo 后面带双引号的话,双引号里面的内容会翻译,输出value echo '$key' echo后面带单引号的话,双 ...
- ATS(App Transport Security)对HTTP协议屏蔽引起的问题
一.问题描述 在学习网络处理的过程,发现代码都没错,运行时会收到如下错误提示: App Transport Security has blocked a cleartext HTTP (http:// ...
- C# 操作IIS方法集合
如果在win8,win7情况下报错:未知错误(0x80005000) 见http://blog.csdn.net/ts1030746080/article/details/8741399 using ...
- ul 仿 table 循环滚动
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 【leetcode】Edit Distance (hard)
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2 ...