提交 881f4a0b 编写于 作者: C Catouse

* add onSetScrollbar option to modal.

上级 5b41c87b
......@@ -16,6 +16,7 @@
* key down
* 4. get moveable options value from '.modal-moveable' on '.modal-dialog'
* 5. add setMoveable method to make modal dialog moveable
* 6. add options.onSetScrollbar
* ======================================================================== */
+ function($, undefined) {
......@@ -95,9 +96,7 @@
headerHeight = headerHeight($header);
}
bodyCss.maxHeight = winHeight - headerHeight;
if ($body.outerHeight() > bodyCss.maxHeight) {
bodyCss.overflow = 'auto';
}
bodyCss.overflow = $body.outerHeight() > bodyCss.maxHeight ? 'auto' : 'visible';
}
$body.css(bodyCss);
......@@ -354,11 +353,20 @@
Modal.prototype.setScrollbar = function() {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
if(this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
if(this.scrollbarWidth) {
var paddingRight = bodyPad + this.scrollbarWidth;
this.$body.css('padding-right', paddingRight)
if (this.options.onSetScrollbar) {
this.options.onSetScrollbar(paddingRight)
}
}
}
Modal.prototype.resetScrollbar = function() {
this.$body.css('padding-right', '')
if (this.options.onSetScrollbar) {
this.options.onSetScrollbar('')
}
}
Modal.prototype.measureScrollbar = function() { // thx walsh
......@@ -432,4 +440,3 @@
})
}(jQuery, undefined);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册