2016-09-10 2 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!' 
      }); 
    }); 
}); 
같은 통지를 트리거하는 클릭 이벤트를 추가 다음과 같은 두 개의 파일을 포함

테스트 버튼을 클릭하면 화면에 아무것도 나타나지 않고 콘솔에 오류가 표시되지 않습니다.

내가 뭘 잘못하고 있니? 오른쪽 상단에 나타나는 간단한 알림은 어떻게 만들 수 있습니까?

답변

0

template$.noty.defaults의 설정이 비어 있습니다. 다음 중 하나를 제공하십시오.

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

스타일이 없어도 작동했습니다. 하지만 기본 통지를 작성하는 것이 어렵 기 때문에 noty를 사용하지 않기로 결정 했으므로 https://notifyjs.com/을 사용하게되었습니다. – Jaylen

관련 문제