【发布时间】:2012-03-10 20:16:01
【问题描述】:
我有以下使用 noty 插件和李子购物车 jQuery 的 jQuery。第一个代码块正确地提醒是/否并正确清空购物车。
第二个代码块使用 noty 正确显示是/否消息,但它不返回真/假,因此购物车没有清空。
我对 jQuery 很陌生,所以我可能遗漏了一些明显的东西!任何帮助将不胜感激:
//This works..
emptycart: function () {
if (!confirm('Are you sure you want to empty your cart?')) {
return false;
}
},
//This doesnt work..
emptycart: function () {
confirm.call(this, noty({
text: 'Are you sure you want to empty the cart ?',
buttons: [
{type: 'button green', text: 'Ok', click: function() { return false; } },
{type: 'button pink', text: 'Cancel', click: function() { return true; } }
],
closable: false,
timeout: false
}),
true
);
return false;
},
【问题讨论】:
-
你能做一个jsfiddle吗?
标签: javascript jquery jquery-plugins