当用户调整对话框的大小时,它会在几十次以下执行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/ –