// define class Panel
|
function Panel(panel) {
|
this.panel = panel; // 面板
|
this.width = this.panel.width(); // 面板初始宽度
|
this.ht = this.panel.height(); // 面板初始高度
|
this.parent = $('.panel').parent(); // 面板容器
|
this.parentWidth = this.parent.width(); // 面板容器宽度
|
this.parentHt = this.parent.height(); // 面板容器高度
|
}
|
|
Panel.prototype.setPanelLayout = function() {
|
// 判断panel的高度是否超出容器的高度
|
if(this.ht > this.parentHt) {
|
this.panel.css('overflow-y', 'scroll');
|
this.panel.height(this.parentHt);
|
}
|
|
console.info('样式设置已执行');
|
}
|
|
Panel.prototype.showPanel = function() {
|
this.parentHt = this.parent.height(); // 面板容器高度
|
var panelWidth = 300;
|
this.parent.find('.panel-mask').remove();
|
this.panel.animate({width: panelWidth});
|
this.panel.before($('<div class="panel-mask position-left" style="float: left"></div>'));
|
this.parent.find('.panel-mask').height(this.parentHt);
|
|
}
|
|
Panel.prototype.hidePanel = function() {
|
this.panel.animate({width: '0'});
|
this.parent.find('.panel-mask').remove();
|
}
|