1、div模拟textarea
<div contenteditable='true'></div>
contenteditable='true'表示该元素内容可编辑;
contenteditable='false'表示该元素内容不可编辑;
2、移动设备忽略页面中的数字识别为电话号码
<meta name="format-detection" content="telephone=no" />
3、阻止滚动穿透
$(弹出层).bind('touchmove', function(e) {
e.preventDefault();
}, false);
})
4、图片错误,替换默认图
$('img').error(function(){
$(this).attr('src','默认图');
})
5、取消点击的效果
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
-webkit-tap-highlight-color: transparent;
6、是否支持触摸事件
var supportTouch = "createTouch" in document //判断是否支持触摸事件
var SupportsTouches = ("createTouch" in document),//判断是否支持触摸
StartEvent = SupportsTouches ? "touchstart" : "mousedown",//支持触摸式使用相应的事件替代
MoveEvent = SupportsTouches ? "touchmove" : "mousemove",
EndEvent = SupportsTouches ? "touchend" : "mouseup",
网友评论