且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery UI可调整大小的防火窗口调整大小事件

更新时间: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(); 
});