blob: 75de557efeffe67bc491919dc60ab7ec81114afd [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<!doctype html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="description" content="A front-end template that helps you build fast, modern mobile web apps.">
7 <meta name="viewport" content="width=device-width, initial-scale=1">
8 <title>snackbar test</title>
9
10 <!-- Fonts -->
11 <link href='https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&amp;lang=en' rel='stylesheet' type='text/css'>
12 <link href="https://fonts.googleapis.com/icon?family=Material+Icons"
13 rel="stylesheet">
14
15 <!-- Page styles -->
16 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/0.0.1/prism.min.css">
17 <link rel="stylesheet" href="../../material.min.css">
18 <link rel="stylesheet" href="../../components/demos.css">
19 <script src="../../material.min.js"></script>
20
21
22 <style>
23
24 </style>
25
26 </head>
27 <body>
28
29 <div style="padding-top: 24px;">
30
31
32<button id="demo-show-snackbar" class="mdl-button mdl-js-button mdl-button--raised" type="button">Show Snackbar</button>
33<div id="demo-snackbar-example" class="mdl-js-snackbar mdl-snackbar">
34 <div class="mdl-snackbar__text"></div>
35 <button class="mdl-snackbar__action" type="button"></button>
36</div>
37<script>
38(function() {
39 'use strict';
40 var snackbarContainer = document.querySelector('#demo-snackbar-example');
41 var showSnackbarButton = document.querySelector('#demo-show-snackbar');
42 var handler = function(event) {
43 showSnackbarButton.style.backgroundColor = '';
44 };
45 showSnackbarButton.addEventListener('click', function() {
46 'use strict';
47 showSnackbarButton.style.backgroundColor = '#' +
48 Math.floor(Math.random() * 0xFFFFFF).toString(16);
49 var data = {
50 message: 'Button color changed.',
51 timeout: 2000,
52 actionHandler: handler,
53 actionText: 'Undo'
54 };
55 snackbarContainer.MaterialSnackbar.showSnackbar(data);
56 });
57}());
58</script>
59
60<button id="demo-show-toast" class="mdl-button mdl-js-button mdl-button--raised" type="button">Show Toast</button>
61<div id="demo-toast-example" class="mdl-js-snackbar mdl-snackbar">
62 <div class="mdl-snackbar__text"></div>
63 <button class="mdl-snackbar__action" type="button"></button>
64</div>
65<script>
66(function() {
67 'use strict';
68 window['counter'] = 0;
69 var snackbarContainer = document.querySelector('#demo-toast-example');
70 var showToastButton = document.querySelector('#demo-show-toast');
71 showToastButton.addEventListener('click', function() {
72 'use strict';
73 var data = {message: 'Example Message # ' + ++counter};
74 snackbarContainer.MaterialSnackbar.showSnackbar(data);
75 });
76}());
77</script>
78
79
80 </div>
81 <!-- Built with love using Material Design Lite -->
82
83
84 <script>
85
86 </script>
87 </body>
88</html>