更新时间:2023-01-14 09:20:08
所有这些答案不会有帮助。问题是调整大小事件会向窗口冒泡。所以最终e.target将成为窗口,即使调整大小发生在div上。所以真正的答案是简单地停止传播resize事件:
All of these answers are not going to help. The issue is that resize event bubbles up to the window. So eventually the e.target will be the window even if the resize happened on the div. So the real answer is to simply stop propagating the resize event:
$("#mydiv").resizable().on('resize', function (e) {
e.stopPropagation();
});