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