api.html 2.33 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>API</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&amp;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.min.js"></script>

<script type="text/javascript">

    function generate(type) {
        var n = noty({
            text        : type,
            type        : type,
            dismissQueue: false,
            layout      : 'topCenter',
            theme       : 'defaultTheme'
        });
        console.log(type + ' - ' + n.options.id);
        return n;
    }

    $(document).ready(function () {

        var alert = generate('alert');
        var information = generate('information');
        var error = generate('error');
        var warning = generate('warning');
        var notification = generate('notification');
        var success = generate('success');

        setTimeout(function () {
            $.noty.setText(alert.options.id, 'I\'m closing now!'); // same as alert.setText('Text Override')
        }, 1000);

        setTimeout(function () {
            $.noty.close(alert.options.id);
        }, 3000);

        setTimeout(function () {
            $.noty.setType(information.options.id, 'warning'); // same as information.setType('warning')
        }, 5000);

        setTimeout(function () {
            $.noty.setText(information.options.id, 'I\'m closing too. Goodbye!'); // same as information.setType('warning')
        }, 7000);

        setTimeout(function () {
            $.noty.closeAll();
        }, 10000);

    });

</script>
</body>
</html>