HTML
<div class="alert"></div>
js
//提示框
var prompt = function (message, style, time)
{
style = (style === undefined) ? 'alert-success' : style;
time = (time === undefined) ? 1200 : time;
$('<div>')
.appendTo('body')
.addClass('alert ' + style)
.html(message)
.show()
.delay(time)
.fadeOut();
};
// 成功提示
var success_prompt = function(message, time)
{
prompt(message, 'alert-success', time);
};
// 失败提示
var fail_prompt = function(message, time)
{
prompt(message, 'alert-danger', time);
};
// 提醒
var warning_prompt = function(message, time)
{
prompt(message, 'alert-warning', time);
};
css
/* 提示框 */
/* line 25, ../sass/whitebox.scss */
.alert {
display: none;
position: fixed;
top: 0;
left: 50%;
min-width: 200px;
margin-left: -100px;
z-index: 99999;
padding: 15px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert-success {
color: #67c23a;
background-color: #f0f9eb;
border-color: #e1f3d8;
}
/* line 37, ../sass/whitebox.scss */
.alert-danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
/* line 42, ../sass/whitebox.scss */
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}