2017-06-23 82 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'); 

它的工作你可以试试这段代码。