我希望当单击这些链接但没有发生任何事情时,从toastr中弹出通知。
编辑:下面是完整代码http://jsfiddle.net/XaVcR/的杂耍,我不确定我是否正确地包括了toastr,尽管.js成功了
toastr.options.closeButton = true;
toastr.options.positionClass = "toast-bottom-left";
$(document).ready(function() {
$('#success').click(notification('success', 'this was a success!'));
});
function notification( type, message ) {
if( type == 'success' ) {
toastr.success(message,'<i>Success</i>');
} else if( type == 'error' ) {
toastr.error(message,'Error');
} else if( type == 'warning' ) {
toastr.warning(message,'Warning');
} else {
toastr.info(message,'Information');
}
}发布于 2014-03-14 03:17:28
从问题中:
$('#success').click(notification('success', 'this was a success!'));这应该是:
$('#success').click(function() {
notification('success', 'this was a success!');
});您的JSFiddle有:
$('#success').click(function() {
notification('success', 'this was a success!'));
});这是一个语法错误,))位于中间行的末尾。
https://stackoverflow.com/questions/22394101
复制相似问题