ToastR

ToastR Example

by lemon kazi

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css">
<button type="button" class="btn btn-primary" id="showtoast">Show Toast</button>

JavaScript

$('#showtoast').click(function() {
//toastr.success(' Have fun!')

function toasterOptions() {
    toastr.options = {
        "closeButton": true,
        "debug": false,
        "newestOnTop": true,
        "progressBar": true,
        "positionClass": "toast-top-center",
        "preventDuplicates": true,
       // "onclick": null,
        "showDuration": "100",
        "hideDuration": "1000",
        "timeOut": "0",
        "extendedTimeOut": "0",
        "showEasing": "swing",
        "hideEasing": "linear",
        "showMethod": "show",
        "hideMethod": "hide"
    };
  	toastr.options.onclick = function () {
        console.log("Notification clicked");
    };
};


toasterOptions();
toastr.success("Error Message from toastr");
});