2016-09-10 12 views
2

Noty pluginを使用してアプリケーションで通知を作成しようとしています。Notyプラグインで基本的な通知を受け取るにはどうすればよいですか?

残念なことに、私が理解できるようにドキュメントはさらに複雑になっています。私は画面の右上に表示される簡単なアラートを生成することに失敗しています。

ここに私が行ったことがあります。私はこの

$(function(){ 

    $.noty.defaults = { 
     layout: 'topRight', 
     theme: 'defaultTheme', 
     type: 'alert', 
     text: '', 
     dismissQueue: true, // If you want to use queue feature set this true 
     template: '', 
     animation: { 
      open: { height: 'toggle' }, 
      close: { height: 'toggle' }, 
      easing: 'swing', 
      speed: 500 // opening & closing animation speed 
     }, 
     timeout: true, // delay for closing event. Set false for sticky notifications 
     force: false, // adds notification to the beginning of queue when set to true 
     modal: false, 
     maxVisible: 5, // you can set max visible notification for dismissQueue true option 
     closeWith: ['click'], // ['click', 'button', 'hover'] 
     callback: { 
      onShow: function() { }, 
      afterShow: function() { }, 
      onClose: function() { }, 
      afterClose: function() { } 
     }, 
     buttons: false // an array of buttons 
    }; 

}); 

のようにデフォルトの設定を追加

noty/js/noty/jquery-noty.js 
noty/js/noty/layouts/topRight.js 

まず、私はその後、私はこの

$(function(){ 

    $('#test').click(function(){ 
      noty({ 
       text: 'Simple Test!' 
      }); 
    }); 
}); 
のような通知をトリガするためにクリックイベントを追加しました次の2つのファイルが含まれて

テストボタンをクリックすると、画面に何も表示されず、コンソールにエラーも表示されません。

私はここで間違っていますか?右上に表示される簡単な通知を作成するにはどうすればよいですか?

答えて

0

template$.noty.defaultsの設定が空白です。 1つを提供してみてください:

template: '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>', 
+0

これはスタイルなしで機能しました。私はnotyを使用しないことにしました。基本的な通知を作成するのは難しいので、私はhttps://notifyjs.com/を使用してしまいました。 – Jaylen

関連する問題