我的例子是:
$(document).ready(function(){
{% for label, messages in app.session.flashbag.all %}
{% for message in messages %}
$.notify('{{message|trans}}', '{{label}}', [{autoHideDelay : 20000}]);
{% endfor %}
{% endfor %}
$('input[type="date"]').attr('type', 'text');
});
该消息在5秒后消失,因为在notify.js中自动隐藏延迟为5000.如何从html模板更改该消息。因为我表明你不工作。 Thx提前和抱歉我的英语
使用autoHideDelay选项查看具有20000毫秒(20秒)的长持续时间通知的工作示例
$(function(){
var successOptions = {
autoHideDelay: 20000,
showAnimation: "fadeIn",
hideAnimation: "fadeOut",
hideDuration: 700,
arrowShow: false,
className: "success",
};
$("#btnSuccess").on("click", function () {
$.notify("Success message!", successOptions);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script>
<button id="btnSuccess">Display Success</button>