微信公众号网页长按屏蔽默认点击事件后再添加其他事件
2017-11-28 10:11
411 查看
window.ontouchstart = function(e) { e.preventDefault(); }; $.fn.longPress = function(fn) { var timeout = undefined; var $this = this; for(var i = 0;i<$this.length;i++){ $this[i].addEventListener('touchstart', function(event) { timeout = setTimeout(fn, 800); }, false); $this[i].addEventListener('touchend', function(event) { clearTimeout(timeout); }, false); } } $('#div').longPress(function(){ alert(1); });
相关文章推荐
- 微信公众号网页长按屏蔽默认事件后点击动态加载的数据仍可以触发事件
- Flash制作网页广告的并添加点击统计事件
- Android 解决listView item点击事件被其他控件屏蔽的问题
- a标签上添加点击事件,执行完会跳到网页顶端
- iOS给图片(其他view) 添加点击事件
- Objectiv-C 为UIImageView,UILabel等默认没有交互的控件添加点击事件
- Unity 怎么像OnClick()一样添加更多其他点击事件
- RadioGroup动态添加RadioButton,RadioButton设置默认选中第一个,点击其他的RadioButton第一个不再选中,第一个不再选中
- Swiift3.0 UITextFiled键盘返回事件,点击其他区域,键盘收起,停止编辑;UITableViewCell取消选中行,以及系统默认的线的长短调整
- [笨木头Cocos2dx043]小玩半透明遮罩第01篇:添加半透明遮罩,屏蔽下层点击事件
- <li>的鼠标移入移出事件和点击事件分别实现为当前li添加样式,删除其他li样式
- unity开发之八:如何在UGUI其他的组件上添加点击事件(解答)
- 微信小程序循环列表添加默认事件,默认样式,点击后修改样式
- Echarts饼图、柱状图、折线图(pie、bar、line)添加点击事件
- 为asp.net控件点击事件添加Confirm()
- UIView 添加点击事件
- Android屏蔽ListView部分Item点击事件
- [原创]扩展GridView实现多选(全选)、点击行任意位置选择行、选中变色、添加双击事件等
- RecyclerView添加点击事件
- Android RecyclerView使用(二) -给Item添加点击事件