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

来源:互联网 发布:ipad隐藏软件 编辑:程序博客网 时间:2024/06/18 05:21

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;}