#移动端开发笔记 *参考 http://www.nihaoshijie.com.cn/index.php/archives/455
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"name="viewport"/>
<meta content="telephone=no"name="format-detection"/>
<meta content="email=no"name="format-detection"/>
window.scrollY window.scrollX
-webkit-user-select:none
-webkit-appearance:none
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:2;
-webkit-box-orient:vertical;
selector {
background-image: url(no-image-set.png);
background: image-set(url(foo-lowres.png) 1x,url(foo-highres.png) 2x) center;
}
1 尽量都使用touch事件来替换click事件。
2 阻止a链接的click的preventDefault
overflow:auto;
-webkit-overflow-scrolling:touch;
input:focus::-webkit-input-placeholder{
opacity:0;
}
<metaname="apple-mobile-web-app-title"content="标题">
<metacontent="telephone=no"name="format-detection" />
<metacontent="email=no"name="format-detection" />
<a href="tel:020-10086">打电话给:020-10086</a>
<a href="sms:10086">发短信给: 10086</a>
<a href="mailto:me@22278.club">发送邮件: me@22278.club</a>
<input type=file accept="image/*">
上面的文件上传框中,accept 可以限制上传文件的类型,参数为 image/* 是所有图片类型,点击会弹出图库,也可以指定图片格式,
参数设置成 image/png 则可以限制图片类型为png;
参数如果为 video/* 则是选择视频的意思;
accept 还可以设置多个文件格式,语法为 accept="image/gif, image/jpeg" ;
input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill{
box-shadow:inset 0 0 0 1000px #fff;
}
-webkit-tap-highlight-color: rgba(0,0,0,0);
a, img {
-webkit-touch-callout: none; /*禁止长按链接与图片弹出菜单*/
}
ul::-webkit-scrollbar {
display: none;
}
document.body.addEventListener('touchstart', function () {})