您的位置:首页 > 移动开发 > IOS开发

fixed定位在ios中会有小bug,如何通过别的方法做到fixed定位效果?

2017-07-03 16:18 519 查看
html页面的错误提醒,是动态提示的,一开始是隐藏的

<p class="err-p red-color"></p>


js代码:

function error(text){
var u = navigator.userAgent, app = navigator.appVersion;
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if (isiOS) {
window.setTimeout(scrollBottom(), 500);
}
function scrollBottom() {
$('html').animate({scrollTop:0},500);
$('body').animate({scrollTop:0},500);
}
$(".err-p").slideDown().html(text);
setTimeout(function(){
$(".err-p").slideUp();
},2000)
};


css样式:

.err-p{
display: none;
position: fixed;
top: 0px;
left: 0px;
height: 2.5rem;
background: #C7282C;
color: white;
line-height: 2.5rem;
font-size: 1.3rem;
width: 100%;
text-align: center;
z-index: 101;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐