1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
This commit is contained in:
Mark Otto 2017-03-18 18:47:57 -07:00
parent 275821bbb0
commit ae50bb7845
4 changed files with 10 additions and 7 deletions

2
js/dist/modal.js vendored
View file

@ -436,7 +436,7 @@ var Modal = function ($) {
var scrollDiv = document.createElement('div');
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
};

File diff suppressed because one or more lines are too long

11
js/dist/scrollspy.js vendored
View file

@ -126,9 +126,12 @@ var ScrollSpy = function ($) {
target = $(targetSelector)[0];
}
if (target && (target.offsetWidth || target.offsetHeight)) {
// todo (fat): remove sketch reliance on jQuery position/offset
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
if (target) {
var targetBCR = target.getBoundingClientRect();
if (targetBCR.width || targetBCR.height) {
// todo (fat): remove sketch reliance on jQuery position/offset
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
}
}
return null;
}).filter(function (item) {
@ -183,7 +186,7 @@ var ScrollSpy = function ($) {
};
ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() {
return this._scrollElement === window ? window.innerHeight : this._scrollElement.offsetHeight;
return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
};
ScrollSpy.prototype._process = function _process() {

File diff suppressed because one or more lines are too long