修改系统默认 alert 弹框样式
来源:互联网 发布:淘宝淘金币在哪看 编辑:程序博客网 时间:2024/06/17 16:12
修改默认 alert 弹框,思路很简单,定义一个 alert(e) 函数,加载最开头即可。
css部分:
<style>
#msg{
width:266px;
position: fixed;
z-index:999;
top: 49%;
margin-top:-80px;
left:50%;
margin-left:-133px;
background:#fff;
box-shadow:5px 5px 8px #999;
font-size:17px;
color:#666;
border:1px solid #f8f8f8;
text-align: center;
line-height: 2rem;
display:inline-block;
padding-bottom:20px;
border-radius:2px;
}
#msg_top{
background:#f8f8f8;
padding:5px 15px 5px 20px;
text-align:left;
}
#msg_top span{
font-size:22px;
float:right;
cursor:pointer;
}
#msg_cont{
padding:15px 20px 20px;
text-align:left;
}
#msg_clear{
display:inline-block;
color:#fff;
padding:1px 15px;
background:#8fc31f;
border-radius:2px;
float:right;
margin-right:15px;
cursor:pointer;
}
</style>
因为弹框是通过js后期加入的,所以高宽是无法通过js获取的,所以要让弹框居中在窗口中要自己定义一下宽度;或者最外层包一个width:100% 的块,让弹框在这个块中居中
js部分:
<script>
function alert(e){
$("body").append('<div id="msg"><div id="msg_top">信息<span class="msg_close">×</span></div><div id="msg_cont">'+e+'</div><div class="msg_close" id="msg_clear">确定</div></div>');
$(".msg_close").click(function (){
$("#msg").remove();
});
}
</script>
- 修改系统默认 alert 弹框样式
- 修改复选框默认样式
- 修改复选框默认样式
- 修改安卓默认的系统button样式,以及其它系统控件的默认样式
- 系统默认alert弹出框域名title问题
- CSS --- 修改默认下拉框样式
- HTML复选框checkbox默认样式修改
- 修改TabHost默认样式
- 修改TabHost默认样式
- 修改select默认样式
- antd修改默认样式
- firebase推送 修改系统默认notification样式(稀有)
- Android 系统源码修改键盘的默认主题样式
- 修改toolTip 和 Alert样式的方法
- javascript修改网页的默认alert弹窗
- 修改网页的alert弹框样式让你的页面更美观(js封装之路(1.1))
- UIBarButtonItem系统默认样式
- Visio修改默认字体样式
- 哈夫曼压缩算法C语言实现——步骤,详细注释源码
- 统计学习方法
- Convolutional Neural Network-based Place Recognition
- jQuery中JSONP的两种实现方式简单解释
- NSAttributedString
- 修改系统默认 alert 弹框样式
- python matplotlib阶段性总结——word转txt、绘图、文件操作
- 抓取一个网页并解析HTML
- 关于自然语言的实体抽取和舆情分析技术
- 将数组转换为List
- J2EE系列之Spring4学习笔记(十二)--Spring对事务管理
- 线程中断、超时与降级——《亿级流量》内容补充
- 19.隐式Intent
- 灰度变换:imadjust and stretchlim