javascript - Pnotify - javascript 工作正常,css 不工作

标签 javascript html css javascript-framework pnotify

我发现了一个叫做 pnotify 的很酷的小东西,它通过 javascript 和 bootstrap 或 jquery css 提供了非常好的通知警报,但特别是 css 不适合我。

我有这个代码:

<head>

    <title>pNotify test</title>

<!-- jQuery -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
<!-- jQuery UI -->
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css" media="all" rel="stylesheet" type="text/css" />
<!-- Bootstrap -->
<link href="includes/bootstrap/css/bootstrap.css" id="bootstrap-css" rel="stylesheet" type="text/css" />
<link href="includes/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="includes/bootstrap/js/bootstrap.min.js"></script>
<!-- Pnotify -->
<script type="text/javascript" src="jquery.pnotify.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.pnotify.default.css">

function show_stack_info() {
var modal_overlay;
if (typeof info_box != "undefined") {
    info_box.pnotify_display();
    return;
}
info_box = $.pnotify({
    title: "Pines Notify Stacks",
    text: "Stacks are used to position notices and determine where new notices will go when they're created. Each notice that's placed into a stack will be positioned related to the other notices in that stack. There is no limit to the number of stacks, and no limit to the number of notices in each stack.",
    type: "info",
    icon: "picon picon-object-order-raise",
    delay: 20000,
    history: false,
    stack: false,
    before_open: function(pnotify) {
        // Position this notice in the center of the screen.
        pnotify.css({
            "top": ($(window).height() / 2) - (pnotify.height() / 2),
            "left": ($(window).width() / 2) - (pnotify.width() / 2)
        });
        // Make a modal screen overlay.
        if (modal_overlay) modal_overlay.fadeIn("fast");
        else modal_overlay = $("<div />", {
            "class": "ui-widget-overlay",
            "css": {
                "display": "none",
                "position": "fixed",
                "top": "0",
                "bottom": "0",
                "right": "0",
                "left": "0"
            }
        }).appendTo("body").fadeIn("fast");
    },
    before_close: function() {
        modal_overlay.fadeOut("fast");
    }
});

</head>

<body>

<button class="btn source" onclick="$.pnotify({
                    title: 'Oh No!',
                    text: 'Something terrible happened.',
                    type: 'error'
                });">Regular Error</button> 

<button class="btn source" style="margin-left: 10px;" onclick="show_stack_info();">What are stacks?</button>                

</body>

我真的不知道为什么 javascript 可以工作,但根本没有 css 工作。有人可以帮忙吗?

最佳答案

您需要设置样式。如果您使用的是 jquery,请执行以下操作:

 delay: 20000,
 history: false,
 stack: false,
 styling: 'jqueryui'

关于javascript - Pnotify - javascript 工作正常,css 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18213776/

相关文章:

javascript - promise 代码被读取两次

javascript - ui 路线、 Node 、express、404 html 文件

css - 在 css 中使用 blend 或其他东西来显示正文背景图像和页脚颜色

html - 圆 Angular 的最新解决方案是什么?

javascript - jQuery 滑动/切换菜单

css - SASS @import 根据屏幕尺寸导入多个文件

javascript - WinJS 从 LocalState 文件夹中删除文件夹

css - 如何使 parent1 的子元素具有比父 2 的子元素更高的 z-index(与其他父元素具有相同的 z-index)?

css - div上的不同边框图像

javascript - Loopback/SQL中如何查询相关模型的个数?