移动端常见问题总结
2017-03-18 20:05
423 查看
qq浏览器
x5内核浏览器强制横屏或竖屏显示: <meta name="x5-orientation" content="portrait|landscape" />
全屏显示: <meta name="x5-fullscreen" content="true" />
UC浏览器
强制横屏或竖屏显示: <meta name="screen-orientation" content="portrait|landscape" />
全屏显示: <meta name="full-screen" content="yes" />
IOS10 meta user-scalable=no 无效,body或html overflow: hidden无效
使用阻止touchstart事件来模拟
document.addEventListener('touchstart',function(e){e.preventDefault();})
它还可以:
1. 禁止长按选中文字、选中图片、弹出系统菜单
2. 禁止系统滚动条、组织橡皮筋效果(下拉回弹效果)
3. 解决点透问题
4. 也阻止了input等元素获取焦点,可以通过手动为这些元素绑定touchstart阻止冒泡来解决
$('input').addEventListener('touchstart',function(e){e.stopPropogation();});
常见设置
禁止识别电话号码或邮箱: <meta name="format-detection" content="telephone=no,email=no" />
允许识别电话号码: <a href="tel:13524565456">13524565456</a>
允许识别邮件: <a href="mailto:邮箱地址">邮箱地址</a>
设置超链接点击时背景色: a,input,button{-webkit-tap-highlight-color: rgba(0,0,0,0)}
去除按钮默认圆角: input,button{-webkit-appearance:none;border-radius:0;}
禁止用户修改字体大小: body *{-webkit-text-size-adjust: 100%;}
禁止用户选中文字设置: -webkit-user-select: none;
fontboosting: https://zhidao.baidu.com/question/1514399955942799500.html
固定定位fixed在页面滑动的时候抖动问题:
html设置溢出隐藏,顶部和底部绝对定位,然后让main出滚动条,margin-top: header高度,margin-bottom: footer高度,这样就不需要fixed
<body>
<header></header>
<main></main>
<footer></footer>
</body>
ios safri为body设置了溢出隐藏,依然可以横向拖动:
为body设置相对定位,为wrap设置overflow: auto
body{
height: 100%;
margin: 0;
overflow: hidden;
position: relative;
}
#wrap{
height: 100%;
overflow: auto;
}
<body>
<div id="wrap">
<header></header>
<main></main>
<footer></footer>
x5内核浏览器强制横屏或竖屏显示: <meta name="x5-orientation" content="portrait|landscape" />
全屏显示: <meta name="x5-fullscreen" content="true" />
UC浏览器
强制横屏或竖屏显示: <meta name="screen-orientation" content="portrait|landscape" />
全屏显示: <meta name="full-screen" content="yes" />
IOS10 meta user-scalable=no 无效,body或html overflow: hidden无效
使用阻止touchstart事件来模拟
document.addEventListener('touchstart',function(e){e.preventDefault();})
它还可以:
1. 禁止长按选中文字、选中图片、弹出系统菜单
2. 禁止系统滚动条、组织橡皮筋效果(下拉回弹效果)
3. 解决点透问题
4. 也阻止了input等元素获取焦点,可以通过手动为这些元素绑定touchstart阻止冒泡来解决
$('input').addEventListener('touchstart',function(e){e.stopPropogation();});
常见设置
禁止识别电话号码或邮箱: <meta name="format-detection" content="telephone=no,email=no" />
允许识别电话号码: <a href="tel:13524565456">13524565456</a>
允许识别邮件: <a href="mailto:邮箱地址">邮箱地址</a>
设置超链接点击时背景色: a,input,button{-webkit-tap-highlight-color: rgba(0,0,0,0)}
去除按钮默认圆角: input,button{-webkit-appearance:none;border-radius:0;}
禁止用户修改字体大小: body *{-webkit-text-size-adjust: 100%;}
禁止用户选中文字设置: -webkit-user-select: none;
fontboosting: https://zhidao.baidu.com/question/1514399955942799500.html
固定定位fixed在页面滑动的时候抖动问题:
html设置溢出隐藏,顶部和底部绝对定位,然后让main出滚动条,margin-top: header高度,margin-bottom: footer高度,这样就不需要fixed
<body>
<header></header>
<main></main>
<footer></footer>
</body>
ios safri为body设置了溢出隐藏,依然可以横向拖动:
为body设置相对定位,为wrap设置overflow: auto
body{
height: 100%;
margin: 0;
overflow: hidden;
position: relative;
}
#wrap{
height: 100%;
overflow: auto;
}
<body>
<div id="wrap">
<header></header>
<main></main>
<footer></footer>
相关文章推荐
- 倾力总结40条常见的移动端Web页面问题解决方案
- 移动端常见问题总结
- 【推荐收藏】web移动端常见问题总结
- 倾力总结40条常见的移动端Web页面问题解决方案
- 倾力总结40条常见的移动端Web页面问题解决方案
- webapp 移动端常见问题总结
- 第二篇、倾力总结40条常见的移动端Web页面问题解决方案
- 倾力总结40条常见的移动端Web页面问题解决方案
- web移动端常见问题总结
- Php部分常见问题总结
- 开发与测试常见问题总结与建议
- SQL SERVER中一些常见性能问题的总结[转]
- 【转】SQL SERVER中一些常见性能问题的总结
- SQL SERVER中一些常见性能问题的总结
- 针对上午的"asp.net最常见的错误总结"的问题的解决方法!
- Php部分常见问题总结第1/2页
- [转]SQL SERVER中一些常见性能问题的总结
- [原创]Loadruner常见问题解决总结
- VC常见入门问题总结(一)
- Php部分常见问题总结第1/2页