首先,我无法将演示放在 jsFiddle 中,因为它太大了。
Demo
双击配置图标打开窗口,现在如果你调整窗口大小,内容溢出,如果你再次调整大小就可以了,等等。为什么会出现这个问题?(调整大小一次又一次没有..)
这是相关代码:
调整大小事件处理程序:
$('.window-container').live('resize', function(){
var window = $(this).data('window');
window.setWidth(window.windowContainer.width());
window.setHeight(window.windowContainer.height());
window.repaint();
});
重绘方法(仅相关代码):
JWindow.prototype.repaint = function(){
this.windowContainer.hide();
if (this._visible && !this._minimized) this.windowContainer.show();
this.windowContainer.css('position', 'abosolute');
this.windowContainer.css('left', this.getLeft());
this.windowContainer.css('top', this.getTop());
//Resizable
this.windowContainer.resizable('disable');
if (this._resizable){
this.windowContainer.resizable({
containment: 'parent',
ghost: true,
animate: false,
minHeight:100,
minWidth:this.titleLabel.textWidth()+120
});
this.windowContainer.resizable('enable');
}
this.windowContentContainer.css('height',this.windowContainer.innerHeight()-this.titleBarContainer.height()-20);
}