3
我有以下jQuery使用noty插件和梅花購物車jQuery。第一個代碼塊正確地提醒是/否並正確清空購物車。如何使用jQuery noty插件返回true或false?
第二個代碼塊顯示yes/no消息正確使用noty但它不返回true/false,所以購物車沒有清空。
我真的很新的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嗎? – MCSI 2012-08-27 13:28:34