blob: 75de557efeffe67bc491919dc60ab7ec81114afd [file] [log] [blame]
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="A front-end template that helps you build fast, modern mobile web apps.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>snackbar test</title>
<!-- Fonts -->
<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'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<!-- Page styles -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/0.0.1/prism.min.css">
<link rel="stylesheet" href="../../material.min.css">
<link rel="stylesheet" href="../../components/demos.css">
<script src="../../material.min.js"></script>
<style>
</style>
</head>
<body>
<div style="padding-top: 24px;">
<button id="demo-show-snackbar" class="mdl-button mdl-js-button mdl-button--raised" type="button">Show Snackbar</button>
<div id="demo-snackbar-example" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>
<script>
(function() {
'use strict';
var snackbarContainer = document.querySelector('#demo-snackbar-example');
var showSnackbarButton = document.querySelector('#demo-show-snackbar');
var handler = function(event) {
showSnackbarButton.style.backgroundColor = '';
};
showSnackbarButton.addEventListener('click', function() {
'use strict';
showSnackbarButton.style.backgroundColor = '#' +
Math.floor(Math.random() * 0xFFFFFF).toString(16);
var data = {
message: 'Button color changed.',
timeout: 2000,
actionHandler: handler,
actionText: 'Undo'
};
snackbarContainer.MaterialSnackbar.showSnackbar(data);
});
}());
</script>
<button id="demo-show-toast" class="mdl-button mdl-js-button mdl-button--raised" type="button">Show Toast</button>
<div id="demo-toast-example" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>
<script>
(function() {
'use strict';
window['counter'] = 0;
var snackbarContainer = document.querySelector('#demo-toast-example');
var showToastButton = document.querySelector('#demo-show-toast');
showToastButton.addEventListener('click', function() {
'use strict';
var data = {message: 'Example Message # ' + ++counter};
snackbarContainer.MaterialSnackbar.showSnackbar(data);
});
}());
</script>
</div>
<!-- Built with love using Material Design Lite -->
<script>
</script>
</body>
</html>