noty
Version:
noty is a jQuery plugin that makes it easy to create alert - success - error - warning - information - confirmation messages as an alternative the standard alert dialog. Each notification is added to a queue. (Optional)
84 lines (65 loc) • 2.41 kB
HTML
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Notification Types</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="demonstration of some noty capabilities">
<link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic&subset=latin,latin-ext,cyrillic' rel='stylesheet' type='text/css'>
<style type="text/css">
html {
height: 100%;
width: 100%;
}
body {
font-family: 'PT Sans', Tahoma, Arial, serif;
line-height: 13px
}
</style>
<link rel="stylesheet" type="text/css" href="buttons.css"/>
</head>
<body>
<div class="container">
<div id="customContainer"></div>
</div>
<script src="jquery-1.7.2.min.js"></script>
<!-- noty -->
<script type="text/javascript" src="../js/noty/packaged/jquery.noty.packaged.js"></script>
<script type="text/javascript">
function generate(type, layout) {
var n = noty({
text : type,
type : type,
dismissQueue: true,
layout : layout,
theme : 'relax',
buttons : [
{addClass: 'btn btn-primary', text: 'Ok', onClick: function ($noty) {
$noty.close();
noty({dismissQueue: true, force: true, layout: layout, theme: 'defaultTheme', text: 'You clicked "Ok" button', type: 'success'});
}
},
{addClass: 'btn btn-danger', text: 'Cancel', onClick: function ($noty) {
$noty.close();
noty({dismissQueue: true, force: true, layout: layout, theme: 'defaultTheme', text: 'You clicked "Cancel" button', type: 'error'});
}
}
]
});
console.log('html: ' + n.options.id);
}
function generateAll() {
generate('alert', 'topCenter');
generate('information', 'topLeft');
generate('error', 'topRight');
generate('warning', 'center');
generate('notification', 'centerRight');
generate('success', 'centerLeft');
}
$(document).ready(function () {
generateAll();
});
</script>
</body>
</html>