更新时间:2023-02-05 22:41:36
只要你的resizable中有一个自定义的帮助
,就会发生这种情况(虽然我不完全确定原因。 ..)鬼只是一种特定的帮手。如果您查看可调整大小的小部件代码,会在 _renderProxy
函数中看到这一位:
This happens whenever you have a custom helper
in your resizable, (though I'm not entirely sure why...) ghost is just a specific kind of helper. If you look at the resizable widget's code you'll see this bit in the _renderProxy
function:
this.helper.addClass(this._helper).css({
width: this.element.outerWidth() - 1,
height: this.element.outerHeight() - 1,
position: "absolute",
left: this.elementOffset.left + "px",
top: this.elementOffset.top + "px",
zIndex: ++o.zIndex //TODO: Don't modify option
});
我不知道那些 outerWidth的目的是什么 - 1
更改是,但您可以通过扩展小部件来规避它:
I don't know what the purpose of those outerWidth - 1
changes is, but you can circumvent it by extending the widget:
$.widget("ui.resizable", $.ui.resizable, {
_renderProxy: function() {
this._super();
this.helper.css({
width: this.element.outerWidth(),
height: this.element.outerHeight()
});
}
});
免责声明:谨慎使用!我只是展示如何解决这个问题,我不知道是什么原因导致原作者包含那些 -1
,但我认为他有充分的理由。
Disclaimer: use with caution! I'm just showing how to get around the issue, I don't know what caused the original author to include those -1
s but I presume he had good reason.
以下是关于@ılǝ的更新内容: http:// jsfiddle.net/py308nr7/
Here's an update on @ılǝ's fiddle with this: http://jsfiddle.net/py308nr7/