Commit dd7cab84 authored by fat's avatar fat
Browse files

build

parent 615dcb5c
Showing with 55 additions and 17 deletions
+55 -17
...@@ -6635,6 +6635,14 @@ button.close { ...@@ -6635,6 +6635,14 @@ button.close {
margin-right: 0; margin-right: 0;
} }
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 768px) { @media (min-width: 768px) {
.modal-dialog { .modal-dialog {
width: 600px; width: 600px;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5355,6 +5355,13 @@ button.close { ...@@ -5355,6 +5355,13 @@ button.close {
.modal-footer .btn-block + .btn-block { .modal-footer .btn-block + .btn-block {
margin-left: 0; margin-left: 0;
} }
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 768px) { @media (min-width: 768px) {
.modal-dialog { .modal-dialog {
width: 600px; width: 600px;
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -796,6 +796,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -796,6 +796,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var Modal = function (element, options) { var Modal = function (element, options) {
this.options = options this.options = options
this.$body = $(document.body)
this.$element = $(element) this.$element = $(element)
this.$backdrop = this.$backdrop =
this.isShown = null this.isShown = null
...@@ -829,6 +830,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -829,6 +830,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.isShown = true this.isShown = true
this.$body.addClass('modal-open')
this.setScrollbar()
this.escape() this.escape()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
...@@ -837,7 +841,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -837,7 +841,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var transition = $.support.transition && that.$element.hasClass('fade') var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) { if (!that.$element.parent().length) {
that.$element.appendTo(document.body) // don't move modals dom position that.$element.appendTo(that.$body) // don't move modals dom position
} }
that.$element that.$element
...@@ -877,6 +881,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -877,6 +881,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.isShown = false this.isShown = false
this.$body.removeClass('modal-open')
this.resetScrollbar()
this.escape() this.escape()
$(document).off('focusin.bs.modal') $(document).off('focusin.bs.modal')
...@@ -934,7 +941,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -934,7 +941,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var doAnimate = $.support.transition && animate var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body) .appendTo(this.$body)
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return if (e.target !== e.currentTarget) return
...@@ -969,6 +976,26 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -969,6 +976,26 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
} }
} }
Modal.prototype.setScrollbar = function () {
if (document.body.clientHeight <= window.innerHeight) return
var scrollbarWidth = this.measureScrollbar()
var bodyPad = parseInt(this.$body.css('padding-right') || 0)
if (scrollbarWidth) this.$body.css('padding-right', bodyPad + scrollbarWidth)
}
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', '')
}
Modal.prototype.measureScrollbar = function () { // thx walsh
var scrollDiv = document.createElement('div')
scrollDiv.className = 'modal-scrollbar-measure'
this.$body.append(scrollDiv)
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
this.$body[0].removeChild(scrollDiv)
return scrollbarWidth
}
// MODAL PLUGIN DEFINITION // MODAL PLUGIN DEFINITION
// ======================= // =======================
...@@ -1017,10 +1044,6 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -1017,10 +1044,6 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}) })
}) })
$(document)
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
}(jQuery); }(jQuery);
/* ======================================================================== /* ========================================================================
...@@ -1054,7 +1077,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -1054,7 +1077,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
animation: true, animation: true,
placement: 'top', placement: 'top',
selector: false, selector: false,
template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: 'hover focus', trigger: 'hover focus',
title: '', title: '',
delay: 0, delay: 0,
...@@ -1600,7 +1623,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -1600,7 +1623,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
ScrollSpy.prototype.process = function () { ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight var scrollHeight = this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
var maxScroll = scrollHeight - this.$scrollElement.height() var maxScroll = scrollHeight - this.$scrollElement.height()
var offsets = this.offsets var offsets = this.offsets
var targets = this.targets var targets = this.targets
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment