Search code examples
javascriptjquerypnotify

Pines Notify closing notice and stacks


I'm trying to use jQuery Pines Notify 1.2.

1) There is a close button in the notice popup, we can close notice with it. Or when timer reaches to delay value it closes automatically. But is it possible to close notice just by clicking on any point in the notice ?

2) I tried and successfully runned basic ones. But I tried demo page's "Examples of Custom Stacks" part. But they didn't work. For example this:

show_stack_topleft('notice');

function show_stack_topleft(type) {
    var opts = {
        title: "Over Here",
        text: "Check me out. I'm in a different stack.",
        addclass: "stack-topleft",
        stack: stack_topleft
    };
    switch (type) {
    case 'error':
        opts.title = "Oh No";
        opts.text = "Watch out for that water tower!";
        opts.type = "error";
        break;
    case 'info':
        opts.title = "Breaking News";
        opts.text = "Have you met Ted?";
        opts.type = "info";
        break;
    case 'success':
        opts.title = "Good News Everyone";
        opts.text = "I've invented a device that bites shiny metal asses.";
        opts.type = "success";
        break;
    }
    $.pnotify(opts);
}

When I run this code I get that stack_topleft is undefined.
But if I remove stack: stack_topleft line I can't see notice in topleft still.


Solution

  • 1) you will have to add something similar to: $('.ui-pnotify').click(function(){ $(this).remove(); });

    2) you have to define stack_topleft (found on this page: https://github.com/sciactive/pnotify):

    var stack_topleft = {"dir1": "down", "dir2": "right", "push": "top"};