2018-08-23 18:31:25 +02:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2018-12-16 15:39:48 +01:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
2018-08-23 18:31:25 +02:00
|
|
|
<link rel="stylesheet" href="../../../dist/css/bootstrap.min.css">
|
|
|
|
<title>Toast</title>
|
|
|
|
<style>
|
|
|
|
.notifications {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 10px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
|
|
<h1>Toast <small>Bootstrap Visual Test</small></h1>
|
|
|
|
|
|
|
|
<div class="row mt-3">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<button id="btnShowToast" class="btn btn-primary">Show toast</button>
|
|
|
|
<button id="btnHideToast" class="btn btn-primary">Hide toast</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="notifications">
|
2018-09-18 14:37:40 +02:00
|
|
|
<div id="toastAutoHide" class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-delay="2000">
|
2018-08-23 18:31:25 +02:00
|
|
|
<div class="toast-header">
|
2018-11-14 14:59:15 +01:00
|
|
|
<span class="d-block bg-primary rounded mr-2" style="width: 20px; height: 20px;"></span>
|
2018-08-23 18:31:25 +02:00
|
|
|
<strong class="mr-auto">Bootstrap</strong>
|
|
|
|
<small>11 mins ago</small>
|
|
|
|
</div>
|
|
|
|
<div class="toast-body">
|
|
|
|
Hello, world! This is a toast message with <strong>autohide</strong> in 2 seconds
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-08-31 09:18:28 +02:00
|
|
|
<div class="toast" data-autohide="false" role="alert" aria-live="assertive" aria-atomic="true">
|
2018-08-23 18:31:25 +02:00
|
|
|
<div class="toast-header">
|
2018-11-14 14:59:15 +01:00
|
|
|
<span class="d-block bg-primary rounded mr-2" style="width: 20px; height: 20px;"></span>
|
2018-08-23 18:31:25 +02:00
|
|
|
<strong class="mr-auto">Bootstrap</strong>
|
|
|
|
<small class="text-muted">2 seconds ago</small>
|
2018-08-31 09:18:28 +02:00
|
|
|
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
2018-08-23 18:31:25 +02:00
|
|
|
</div>
|
|
|
|
<div class="toast-body">
|
|
|
|
Heads up, toasts will stack automatically
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-11-14 12:02:18 +01:00
|
|
|
<script src="../../dist/dom/polyfill.js"></script>
|
2018-08-23 18:31:25 +02:00
|
|
|
<script src="../../dist/util.js"></script>
|
2018-11-14 12:02:18 +01:00
|
|
|
<script src="../../dist/dom/manipulator.js"></script>
|
|
|
|
<script src="../../dist/dom/data.js"></script>
|
|
|
|
<script src="../../dist/dom/eventHandler.js"></script>
|
2018-08-23 18:31:25 +02:00
|
|
|
<script src="../../dist/toast.js"></script>
|
|
|
|
<script>
|
2018-11-14 12:02:18 +01:00
|
|
|
window.addEventListener('load', function () {
|
2019-02-22 23:37:55 +01:00
|
|
|
Array.from(document.querySelectorAll('.toast'))
|
2018-11-14 12:02:18 +01:00
|
|
|
.forEach(function (toastNode) {
|
|
|
|
new Toast(toastNode)
|
|
|
|
})
|
2018-08-23 18:31:25 +02:00
|
|
|
|
2018-11-14 12:02:18 +01:00
|
|
|
document.getElementById('btnShowToast').addEventListener('click', function () {
|
2019-02-22 23:37:55 +01:00
|
|
|
Array.from(document.querySelectorAll('.toast'))
|
2018-11-14 12:02:18 +01:00
|
|
|
.forEach(function (toastNode) {
|
|
|
|
var toast = Toast._getInstance(toastNode)
|
|
|
|
toast.show()
|
|
|
|
})
|
|
|
|
})
|
2018-08-23 18:31:25 +02:00
|
|
|
|
2018-11-14 12:02:18 +01:00
|
|
|
document.getElementById('btnHideToast').addEventListener('click', function () {
|
2019-02-22 23:37:55 +01:00
|
|
|
Array.from(document.querySelectorAll('.toast'))
|
2018-11-14 12:02:18 +01:00
|
|
|
.forEach(function (toastNode) {
|
|
|
|
var toast = Toast._getInstance(toastNode)
|
|
|
|
toast.hide()
|
|
|
|
})
|
|
|
|
})
|
2018-08-23 18:31:25 +02:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|