Noty Jquery插件不起作用

时间:2016-01-02 23:07:24

标签: jquery

我正在尝试使用Noty插件并按如下方式设置我的页面:

<script type="text/javascript" src="http://127.0.0.1/ecomm/application/assets/js/jquery.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha256-KXn5puMvxCw+dAYznun+drMdG1IFl3agK0p/pqT9KAo= sha512-2e8qq0ETcfWRI4HJBzQiA3UoyFk6tbNyG+qSaIBZLyW9Xf3sWZHN/lxe9fTh1U45DpPf07yj94KsUHHWe4Yk1A==" crossorigin="anonymous"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-7s5uDGW3AHqw6xtJmNNtr+OBRJUlgkNJEo78P4b0yRw= sha512-nNo+yCHEyn0smMxSswnf/OnX6/KwJuZTlNZBjauKhTK0c+zT+q5JOCx0UFhXQ6rJR9jg6Es8gPuD2uZcYDLqSw==" crossorigin="anonymous" />
<link href="http://127.0.0.1/ecomm/application/assets/css/style.css" rel="stylesheet" />

    <script type="text/javascript" src="http://127.0.0.1/ecomm/application/assets/js/noty/packaged/jquery.noty.packaged.min.js"></script>
    <link href="http://127.0.0.1/ecomm/application/assets/css/animate.css" rel="stylesheet">
    <script type="text/javascript" src="http://127.0.0.1/ecomm/application/assets/js/noty/layouts/topRight.js"></script>
    <script type="text/javascript" src="http://127.0.0.1/ecomm/application/assets/js/noty/layouts/top.js"></script>
    <script type="text/javascript" src="http://127.0.0.1/ecomm/application/assets/js/noty/layouts/topLeft.js"></script>
        <script type="text/javascript" src="http://127.0.0.1/ecomm/application/assets/js/noty/themes/default.js"></script>

    <script>

        var n = noty({
            text: 'NOTY - a jquery notification library!',
            animation: {
                open: 'animated bounceInLeft', // Animate.css class names
                close: 'animated bounceOutLeft', // Animate.css class names
                easing: 'swing', // unavailable - no need
                speed: 500 // unavailable - no need
            }
        });



    </script>

然而,它没有显示任何通知并返回:

.
jquery.js:3 Uncaught TypeError: Cannot read property 'style' of undefined
xa  @   jquery.js:3
n.extend.css    @   jquery.js:3
sa  @   jquery.js:3
ta  @   jquery.js:3
Ja  @   jquery.js:3
n.fn.extend.show    @   jquery.js:3
n.fn.(anonymous function)   @   jquery.js:3
b.show  @   jquery.noty.packaged.min.js:1
a.notyRenderer.show @   jquery.noty.packaged.min.js:1
a.notyRenderer.render   @   jquery.noty.packaged.min.js:1
a.notyRenderer.init @   jquery.noty.packaged.min.js:1
window.noty @   jquery.noty.packaged.min.js:1
(anonymous function)    @   index.php:18

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

我没有尝试使用您的代码,但能够为您的目的管理2个演示。

  1. 使用Noty.js
  2. http://jsfiddle.net/otd7huq4/6/

    1. jGrowl(使用jquery通知)
    2. http://jsfiddle.net/mmw8N/15/

      <强>样本 -

      $.jGrowl("Hello world!");
      

      根据我之前的经验,我认为jGrowl更加简单和简单。美丽。