松树通知关闭通知和堆栈

时间:2013-05-04 17:31:34

标签: javascript jquery pnotify

我正在尝试使用jQuery Pines Notify 1.2。

1)通知弹出窗口中有一个关闭按钮,我们可以用它关闭通知。或者当计时器达到延迟值时,它会自动关闭。但是,是否可以通过点击通知中的任何一点来关闭通知?

2)我尝试并成功运行了基本的。但我尝试了demo page的“自定义堆栈示例”部分。但他们没有工作。例如:

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);
}

当我运行此代码时,我得到stack_topleft is undefined 但如果我删除stack: stack_topleft行,我仍然无法看到通知。

1 个答案:

答案 0 :(得分:4)

1)你必须添加类似的东西:  $('。ui-pnotify')。click(function(){$(this).remove();});

2)您必须定义stack_topleft(在此页面上找到:https://github.com/sciactive/pnotify):

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