前言:在这个看脸的时代,页面美观固然是跟重要的,系统自带的弹框样式满足不了UI设计的需求,那么只能自己动手做一个了。
公共js代码:
//公共提示框function myalert(str) {var div = '<div class="mark"></div>';$('body').append(div)$('.mark').html(str);$('.mark').show();setTimeout(function() {$('.mark').hide();$('.mark').remove();}, 2000)}
公共css代码:
/*自制弹窗样式*/.mark {display: none;position: fixed;top: 0;right: 0;bottom: 0;left: 0;margin: auto;height: 0.88rem;line-height: 0.88rem;width: 80%;text-align: center;font-size: 0.28rem;color: #fff;background: rgba(0, 0, 0, 0.6);border-radius: 0.1rem;}
页面引用:
//你的代码myalert('您要提示的内容');//你的代码