2017-06-23 80 views
-1

我正在嘗試執行Toastr。現在改變Toastr位置?

我能得到警報和祝酒詞如預期,但我不能應用其他選項。 它只是遵循默認選項。

我想是這樣的:

var options = { 
"closeButton": true, 
"debug": false, 
"newestOnTop": false, 
"progressBar": true, 
"positionClass": "toast-bottom-center", 
"preventDuplicates": false, 
"showDuration": "300", 
"hideDuration": "1000", 
"timeOut": "5000", 
"extendedTimeOut": "1000", 
"showEasing": "swing", 
"hideEasing": "linear", 
"showMethod": "fadeIn", 
"hideMethod": "fadeOut" 
} 
$.simplyToast('This is a success message!', 'success',options); 

console.log(options); 

console.log($.simplyToast); 

現在它不具備行爲如預期,我已經設置positionClass到BottomCenter但我總是默認顯示右上角。

我怎樣才能改變像其demo page提到的選項。

+0

什麼是'$ .simplyToast'? AFAIK,這些選項是'toastr',而不是'simplyToast'。 – 31piy

+0

我從Github下載了代碼,它幫助注意到演示頁面是這樣的,所以我使用的代碼,可以幫助我與toastr – Rajan

+1

SimplyToast和Toastr是兩個單獨的插件。有關toastr的更多詳細信息,請參閱[本站點](https://github.com/CodeSeven/toastr)。 – 31piy

回答

1

希望它的工作:) 剛剛嘗試在你的代碼

toastr.success('We do have the Kapua suite available.', 'Turtle Bay Resort', options);

+0

我已經包含了'構建/ toastr.js',但我得到的錯誤是這樣的:'未捕獲的ReferenceError:敬酒不defined' – Rajan

+0

好了,你可以檢查你的。 JS按照該鏈接** **的script.js [點擊ME(http://plnkr.co/edit/6W9URNyyp2ItO4aUWzBB?p=preview) –

+0

謝謝我想我自己看着辦吧,現在 – Rajan

0

您可以添加成功以及錯誤也。

set_toastr('', 'This is a success message!', 'success'); 

它的工作你可以試試這段代碼。