在我们滑动手机的时候,如果LI或者DIV标签可以点击,那么在移动端给用户一个效果

/*id为添加效果LI上的UL的ID,或者是当前DIV的ID*/
function doTouchPublic(id){
setTimeout(function(){
var obj=document.getElementById(id);
touchPublic.tagUltagDiv(obj);
},300);
};
var touchPublic={
tagUltagDiv:function(obj){
var objAll;
/*如果对象为UL,那么给LI添加事件,否则给DIV当前对象添加事件*/
if(obj.tagName=="UL"){
objAll=obj.childNodes;
}else{
objAll=obj;
}
touchPublic.touchMoveEndIf(objAll);
},
/*li做委托事件,on为JQ中委托事件*/
touchMoveEndIf:function(obj){ $(obj).on('touchstart',function(){
touchPublic.touchObjstart(this,"objRowOver");
})
/*触摸滑动,e.preventDefault();是为了让end触发*/
$(obj).on('touchmove',function(){
touchPublic.touchObjend(this,"objRowOver");
});
/*触摸离开*/
$(obj).on('touchend',function(){
touchPublic.touchObjend(this,"objRowOver");
}); },
touchObjstart:function(that,color){
$(that).addClass(color);
},
touchObjend:function(that,color){
if($(that).attr('class')==color){
$(that).removeClass(color);
}
}
}

手机端touchstart,touchmove,touchend事件,优化用户划入某个可以点击LI的效果的更多相关文章

  1. 移动端的touchstart,touchmove,touchend事件中的获取当前touch位置

    前提:touchstart,touchmove,touchend这三个事件可以通过原生和jq绑定. 原生:document.querySelector("#aa").addEven ...

  2. touchstart,touchmove,touchend事件 写法

    jQuery写法: $('#id').on('touchstart',function(e) { var _touch = e.originalEvent.targetTouches[0]; var ...

  3. touchstart和touchend事件

    touchstart和touchend事件 移动互联网是未来的发展趋势,现在国内很多互联网大佬都在争取移动这一块大饼,如微信及支付宝是目前比较成功的例子,当然还有各种APP和web运用. 由于公司的需 ...

  4. 获取touchstart,touchmove,touchend 坐标

    简单说下如何用jQuery 和 js原生代码获取touchstart,touchmove,touchend 坐标值: jQuery 代码: $('#id').on('touchstart',funct ...

  5. touchstart,touchmove,touchend触摸事件的小小实践心得

    近段时间使用html5开发一个公司内部应用,而触摸事件必然是移动应用中所必须的,刚开始以为移动设备上或许也会支持鼠标事件,原来是不支持的,好在webkit内核的移动浏览器支持touch事件,并且打包成 ...

  6. 移动端touchstart,touchmove,touchend

    近段时间使用html5开发一个公司内部应用,而触摸事件必然是移动应用中所必须的,刚开始以为移动设备上或许也会支持鼠标事件,原来是不支持的,好在webkit内核的移动浏览器支持touch事件,并且打包成 ...

  7. js 手机端触发事事件、javascript手机端/移动端触发事件

    处理Touch事件能让你跟踪用户的每一根手指的位置.你可以绑定以下四种Touch事件: touchstart: // 手指放到屏幕上的时候触发 touchmove: // 手指在屏幕上移动的时候触发 ...

  8. 手机端html5触屏事件(touch事件)

    touchstart:触摸开始的时候触发 touchmove:手指在屏幕上滑动的时候触发 touchend:触摸结束的时候触发 而每个触摸事件都包括了三个触摸列表,每个列表里包含了对应的一系列触摸点( ...

  9. (转)手机端html5触屏事件(touch事件)

    本文转载自:http://blog.sina.com.cn/s/blog_51048da70101f0ex.html touchstart:触摸开始的时候触发 touchmove:手指在屏幕上滑动的时 ...

随机推荐

  1. c++面试题目解析

    1.指针和引用的区别 答:A.指针可修改,引用不可改. B.指针占用内存,引用不占内存. C.引用不能为空   指针可以为空. 2.memcpy和strcpy的区别 答:strcpy  会拷贝到\0结 ...

  2. SpringMVC中Controller跳转到另一个Controller方法

    1.直接Redirect后加 Controller/Action Response.Redirect("/User/Edit"); return Redirect("/U ...

  3. iOS keyChain 的使用

    详细资料,请参看苹果官方文档Keychain Services Reference . ios中的keychain,用于保存用户的机密信息,对keychain的操作有4种,就是 增,删,改,查: Se ...

  4. linux grep 查找字符串

    2015年8月27日 12:04:58 在当前文件夹查找 public function abc() grep -re 'public function abc\b' . // 可以不加e, 适合函数 ...

  5. C#小知识特殊的DefaultValueAttribute

    今天看别人写的源码发现一个特殊的DefaultValueAttribute.使用如下. 原始代码: public class People { private string _Name = " ...

  6. nyoj_31

    题目描述:五个数求最值. #include <iostream> #include <algorithm> using namespace std; int main(){ ] ...

  7. ClassLoad的加载过程及分析

    -Xbootclasspath:bootclasspath 让jvm从指定路径(可以是分号分隔的目录.jar.或者zip)中加载bootclass,用来替换jdk的rt.jar:若非必要,一般不会用到 ...

  8. 【linux】find删除指定时间之前的文件

    今天磁盘满了,想删掉一些老的日志文件.开始想写个python脚本,转念一想,可能shell脚本好点.结果发现,根本不用写脚本,一个find指令就可以解决问题了. 先上指令 -exec rm {} \; ...

  9. LeetCode 459 Repeated Substring Pattern

    Problem: Given a non-empty string check if it can be constructed by taking a substring of it and app ...

  10. HDU 5833 Zhu and 772002 (数论+高斯消元)

    题目链接 题意:给定n个数,这n个数的素因子值不超过2000,从中取任意个数使其乘积为完全平方数,问有多少种取法. 题解:开始用素筛枚举写了半天TLE了,后来队友说高斯消元才想起来,果断用模板.赛后又 ...