Я пытаюсь изменить positionclass для моего тоста на нажатие div.
positionclass: не изменяется на нижний. что мне здесь не хватает?
и как использовать
toastr.optionsOverride = 'positionclass: toast-bottom-full-width';
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<head>
<title></title>
<script type ="text/javascript" src ="@Url.Content("~/Scripts/jquery-1.6.4.js")"></script>
<script type ="text/javascript" src ="@Url.Content("~/Scripts/toastr.js")"></script>
<link rel="stylesheet" type="text/css" href="~/content/toastr.css" />
</head>
<script type="text/javascript">
$(document).ready(function () {
// show when page load
toastr.info('Page Loaded!');
$('#linkButton').click(function () {
toastr.optionsOverride = 'positionclass:toast-bottom-full-width';
// show when the button is clicked
toastr.success('Click Button', 'ButtonClick', 'positionclass:toast-bottom-full-width');
});
});
</script>
<body>
<div id ="linkButton" > click here</div>
</body>
обновление 1
после отладки я заметил, что ниже метод getOptions из toastr.js является переопределяющим 'positionclass: toast-bottom-full-width' to 'toast-top-right'
function getOptions() {
return $.extend({}, defaults, toastr.options);
}
update 2 Строка 140 в toastr.js не успешно , расширяющая m optionsOverride in to options.
if (typeof (map.optionsOverride) !== 'undefined') {
options = $.extend(options, map.optionsOverride);
iconClass = map.optionsOverride.iconClass || iconClass;
}
обновление 3 Вопрос о выпуске исправлен, но я должен указать класс позиции 3 раза, как показано ниже. Я уверен, что есть менее шумный способ достичь этого.
$('#linkButton').click(function () {
toastr.optionsOverride = 'positionclass = "toast-bottom-full-width"';
toastr.options.positionClass = 'toast-bottom-full-width';
//show when the button is clicked
toastr.success('Click Button', 'ButtonClick', 'positionclass = "toast-bottom-full-width"');
});