Javascript 反向jquery调整移位功能
使用jqueryresizeplugin调整div大小时,如果按住shift键,纵横比将保持不变 有可能{aspectRatio:true}到选项列表,如果我按住shift键禁用纵横比Javascript 反向jquery调整移位功能,javascript,jquery,Javascript,Jquery,使用jqueryresizeplugin调整div大小时,如果按住shift键,纵横比将保持不变 有可能{aspectRatio:true}到选项列表,如果我按住shift键禁用纵横比 谢谢。我通过修改小部件来管理: 取代 if (this._aspectRatio || b.shiftKey) 与 您可以在不接触源文件的情况下对jquery可调整大小的代码进行修补,因此您仍然可以使用其CDN var mouseDrag = $.ui.resizable.prototype._mouseDra
谢谢。我通过修改小部件来管理: 取代
if (this._aspectRatio || b.shiftKey)
与
您可以在不接触源文件的情况下对jquery可调整大小的代码进行修补,因此您仍然可以使用其CDN
var mouseDrag = $.ui.resizable.prototype._mouseDrag;
$.ui.resizable.prototype._mouseDrag = function (event) {
event.shiftKey = !event.shiftKey;
var aspectRatio = this._aspectRatio;
this._aspectRatio = aspectRatio && event.shiftKey;
mouseDrag.apply(this, arguments);
this._aspectRatio = aspectRatio;
};
你能更具体地说明你使用的是哪个插件吗?可能是文档的链接?当然。
var mouseDrag = $.ui.resizable.prototype._mouseDrag;
$.ui.resizable.prototype._mouseDrag = function (event) {
event.shiftKey = !event.shiftKey;
var aspectRatio = this._aspectRatio;
this._aspectRatio = aspectRatio && event.shiftKey;
mouseDrag.apply(this, arguments);
this._aspectRatio = aspectRatio;
};