gpt4 book ai didi

c# - Pnotify 通知颜色错误

转载 作者:行者123 更新时间:2023-11-28 16:28:36 25 4
gpt4 key购买 nike

您好,我正在尝试更改每个通知的颜色,但我无法从哪里找到。我正在使用 jqueryui 作为样式。您可以在下面看到错误和成功通知如何出现在我的屏幕上!

enter image description here

enter image description here

这是我用来动态构建调用 pnotify 的脚本的代码

string script1 = @"var displayIcon = " + displayIcon + @";
$(function(){
new PNotify({
title: '" + messageString + @"',
styling: 'jqueryui',
width: '400px',
opacity: 0.9,
type: '" + typeLowercase + @"',
icon: displayIcon,
hide: false,
buttons: {
sticker: false
},
animation: {
effect_in: 'fade',
effect_out: 'slide'
}
});
});";

最佳答案

初始化 PNotify 时没有background-colour 选项。您需要为任何自定义样式使用 addclass 选项。 ui.pnotify .ui-pnotify-container 定义通知的背景颜色。将附加类附加到 ui.pnotify 的末尾(例如 ui.pnotify.myclass)并为其分配 background-color 将允许您在初始化阶段使用myclass

因此,如果您想要为通知分配红色背景色,您需要创建如下 css 规则:

.ui-pnotify.red .ui-pnotify-container {
background-color: red !important;
}

然后,在初始化阶段,您可以像这样使用addclass选项:

$(function() {
new PNotify({
title: '" + messageString + @"',
styling: 'jqueryui',
width: '400px',
opacity: 0.9,
type: '" + typeLowercase + @"',
icon: displayIcon,
hide: false,
addclass: 'red',
buttons: {
sticker: false
},
animation: {
effect_in: 'fade',
effect_out: 'slide'
}
});
});

addclass选项中指定自定义类名时,不需要包含ui-pnotify;只是后面的类的名称(在本例中为 red)。

在下面的 fiddle 中,我创建了两个自定义类(redblue)。将 addclass 的值更改为 redblue 以查看自定义背景颜色:

Fiddle Demo

关于c# - Pnotify 通知颜色错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35647735/

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