js 单个控件的单击 双击 长按 拖动共存方案
2017-10-09 10:04
309 查看
前段时间做了一个实时操控手机的前端页面 其中涉及到的单个控件的单击 双击 长按 拖动共存觉得挺好玩的在这里给大家分享一下,废话不多说直接上代码:
$("#mouseOver").click(function (event) { clearTimeout(timer); timer = setTimeout(function (){ if (movedown == false) { console.log("Start run click"); /*click things*/ }else{
/*click cancle*/
} }, 300); });
$("#mouseOver").mousedown(function (event){
movedown = false;
clearTimeout(movedowntimer);
movedowntimer = setTimeout(function(){
/*swipe and hold things*/
movedown = true;
},300); });
$("#mouseOver").mouseup(function (event){console.log(movedown);if(movedown){
/*swipe and hold things*/}else{
clearTimeout(movedowntimer);
} });
$("#mouseOver").dblclick(function (event) {
clearTimeout(timer);
if(com == false){
return; }
/*double click things*/});
相关文章推荐
- JS实现鼠标单击与双击事件共存
- JS单击与双击事件共存
- 扩展GridView控件(6) - 响应行的单击事件和双击事件
- js鼠标单击和双击事件冲突问题的解决方法
- js 如何避免鼠标单击和双击冲突
- 解决鼠标拖动和单击事件共存
- 扩展GridView控件(6) - 响应行的单击事件和双击事件
- 自定义onTouch事件,单击、双击、拖动
- js 同时实现单击事件和双击事件
- js鼠标单击和双击事件冲突问题的解决方法
- 单击和双击共存
- 扩展GridView控件(6) - 响应行的单击事件和双击事件
- 树形控件设定图标以及“双击”与“单击时选中”处理
- js鼠标单击和双击事件冲突问题的快速解决方法
- 上接扩展GridView控件(6) - 响应行的单击事件和双击事件
- Android ListView最佳处理方式,ListView拖动防重复数据显示,单击响应子控件
- 通过js实现单击或双击直接修改内容
- js 单击与双击事件
- 关于android 控件的单击双击以及长按的问题