如何设置页面上允许显示的最大消息
bootstrap-notify.js - How to set maximum displayed message allowed on page?
这是我正在使用的引导通知设置:
var options = {
title: title,
message: message
};
var settings = {
element: '#page-wrapper',
position: 'fixed',
type: type,
placement: {
from: "top",
align: "center"
},
z_index: 3000,
animate: {
enter: "animated fadeInDown",
exit: "animated fadeOutUp",
},
template:
'<div data-notify="container" role="alert" class="col-xs-11 col-sm-8 alert alert-{0}" style="margin: 15px 0 15px 0">'
<button type="button" class="close" data-notify="dismiss">'
<span aria-hidden="true">×</span>'
<span class="sr-only">Close</span>'
</button>'
<span data-notify="icon"></span>'
<span data-notify="title">{1}</span>'
<span data-notify="message" style="padding-right:15px">{2}</span>'
<a href="{3}" target="{4}" data-notify="url"></a>'
</div>'
};
$.notify(options, settings);
我想设置在任何时候显示在页面上的消息的最大数量,这样它就不会被消息淹没。
template:
'<div data-notify="container" role="alert" class="col-xs-11 col-sm-2 alert alert-{0}" style="margin: 15px 0 15px 0; width: 150px;">'
<button type="button" class="close" data-notify="dismiss" style="top:7px;">'
<span aria-hidden="true">×</span>'
<span class="sr-only">Close</span>'
</button>'
<span data-notify="icon"></span>'
<span data-notify="title">{1}</span>'
<span data-notify="message" style="padding-right:15px">{2}</span>'
<a href="{3}" target="{4}" data-notify="url"></a>'
</div>'
为样式添加宽度,就可以了!
在模板设置中给出一个类来通知div元素,并在通知之前删除它。这样的:
$('div.notification').remove();
$.notify({
message: "I hope I can help you"
}, {
type: 'danger',
template: '<div data-notify="container" class="notification alert alert-{0}" role="alert">' +
'<img data-notify="icon" class="img-circle pull-left">' +
'<span data-notify="title">{1}</span>' +
'<span data-notify="message" style="display: inline-block;">{2}</span>' +
'</div>'
});
相关文章:
- 如果下载不成功,如何显示消息
- 如何在 jquery 中的速率按钮下方显示消息状态
- 删除所有可拖动元素后如何显示消息
- php表单验证n在表单上显示消息3秒钟并淡出
- 单击“点赞”按钮时显示消息
- javascript初学者-无法在屏幕上显示消息框
- 在表单提交后显示消息的方法
- 遍历列表,并在jQuery为空时显示消息
- 在jquery幻灯片登录表单上显示消息
- 如果文本筛选器在ng重复中未返回结果,则显示消息
- 以javascript显示消息框
- 在angular 1中,我如何检测angular是否受支持,并在屏幕上显示消息's不受支持
- 浏览器全屏显示,按键时不显示消息
- 选取随机数组元素,将其移除,并在没有更多可用元素时显示消息
- 仅当浏览器不是Google Chrome时显示消息
- 如果所有李都被隐藏,则显示消息
- 在提交表单和显示消息之前,如何检查表单输入是否全是数字
- 如果使用 JavaScript 登录失败,如何在登录页面中显示消息
- j查询验证未显示消息
- 为什么不显示消息