gpt4 book ai didi

javascript - Pines Notify 关闭通知和堆栈

转载 作者:行者123 更新时间:2023-11-30 10:32:02 27 4
gpt4 key购买 nike

我正在尝试使用 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 行,我仍然看不到 topleft 中的通知。

最佳答案

1) 您必须添加类似于以下内容的内容: $('.ui-pnotify').click(函数(){ $(this).remove(); });

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

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

关于javascript - Pines Notify 关闭通知和堆栈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16377082/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com