當用戶調整對話框的大小時,它會在幾十次以下執行POST。有沒有辦法阻止它執行$ .post,直到用戶釋放鼠標按鈕。調整大小後的執行帖子(當窗口正在調整大小時不會重複)
dialogClass: 'fixed-dialog',
resize: function(event, ui) {
$(this).dialog("option",
ui.size.height + " x " + ui.size.width);
$.post("savelayout.php", {
menuheight: ui.size.height,
menuwidth: ui.size.width
});
}
編輯:從例子,因爲它沒有功能刪除更新的代碼。
http://alvarotrigo.com/blog/firing-resize-event-only-once-when-resizing-is-finished/ –