1.微信用扣扣浏览器,去除边框阴影
*{
-webkit-tap-highlight-color:rgba(255,0,0,0);
appearance: none;
-moz-appearance: none;
/* Firefox */
-webkit-appearance: none;
/* Safari 和 Chrome */
}
2.页面拖拽
mousedown,mouseup,mousemove 和touchstart,touchend,touchmove之间是可以互通的,也就是说一般面向pc开发的mouse时间对touch事件有效,据说 是效率有差异。但是pc上测试没有任何问题,在手机上就是无效。
<script type="text/javascript">
//兼容手机页面拖拽
var isdrag = false;
var tx, x;
$(function() {
document.getElementById("preview").addEventListener('touchend', function() {
sdrag = false;
});
document.getElementById("preview").addEventListener('touchstart', selectmouse);
document.getElementById("preview").addEventListener('touchmove', movemouse);
});
function movemouse(e) {
if (isdrag) {
var n = tx + e.touches[0].pageX - x;
$("#preview").css("left", n);
return false;
}
}
function selectmouse(e) {
isdrag = true;
tx = parseInt(document.getElementById("preview").style.left + 0);
x = e.touches[0].pageX;
return false;
}
</script>