我是 JS 的新手,不确定如何在我的页面上进行这项工作。以下是我所拥有的。我必须如何制作此警报显示?
我正确添加了源,但不确定如何呈现警报。
<!doctype html>
<html>
<head>
<title>Toast</title>
<link href="toastr.css" rel="stylesheet"/>
<script src="toastr.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
$(document).ready(function() {
//toastr.info('Are you the 6 fingered man?')
Command: toastr[success](" ", "Settings Saved!")
toastr.options: {
"debug": false,
"positionClass": "toast-top-right",
"onclick": null,
"fadeIn": 300,
"fadeOut": 1000,
"timeOut": 5000,
"extendedTimeOut": 1000
}
});
</script>
</head>
<body>
</body>
</html>
原文由 starbucks 发布,翻译遵循 CC BY-SA 4.0 许可协议
Toastr 是一个非常好的组件,您可以使用以下命令显示消息:
如果您想在 toastr 消息上提供标题,只需添加第二个参数:
您还可以使用如下方式更改默认行为:
在项目的 github 上 查看更多信息。
编辑
使用示例:
和一个 HTML: