1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-08 22:56:46 +02:00
This commit is contained in:
XhmikosR
2019-03-11 17:13:30 +02:00
parent c2b05dd7b5
commit ac67e04ce0
42 changed files with 5134 additions and 179 deletions

11
js/dist/scrollspy.js vendored
View File

@@ -71,7 +71,8 @@
* --------------------------------------------------------------------------
*/
var MAX_UID = 1000000;
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
var _window = window,
jQuery = _window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
var toType = function toType(obj) {
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
@@ -102,7 +103,7 @@
try {
return document.querySelector(selector) ? selector : null;
} catch (err) {
} catch (error) {
return null;
}
};
@@ -159,18 +160,15 @@
};
var ClassName = {
DROPDOWN_ITEM: 'dropdown-item',
DROPDOWN_MENU: 'dropdown-menu',
ACTIVE: 'active'
};
var Selector = {
DATA_SPY: '[data-spy="scroll"]',
ACTIVE: '.active',
NAV_LIST_GROUP: '.nav, .list-group',
NAV_LINKS: '.nav-link',
NAV_ITEMS: '.nav-item',
LIST_ITEMS: '.list-group-item',
DROPDOWN: '.dropdown',
DROPDOWN_ITEMS: '.dropdown-item',
DROPDOWN_TOGGLE: '.dropdown-toggle'
};
var OffsetMethod = {
@@ -193,7 +191,7 @@
this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config);
this._selector = this._config.target + " " + Selector.NAV_LINKS + "," + (this._config.target + " " + Selector.LIST_ITEMS + ",") + (this._config.target + " " + Selector.DROPDOWN_ITEMS);
this._selector = this._config.target + " " + Selector.NAV_LINKS + "," + (this._config.target + " " + Selector.LIST_ITEMS + ",") + (this._config.target + " ." + ClassName.DROPDOWN_ITEM);
this._offsets = [];
this._targets = [];
this._activeTarget = null;
@@ -234,7 +232,6 @@
var targetBCR = target.getBoundingClientRect();
if (targetBCR.width || targetBCR.height) {
// TODO (fat): remove sketch reliance on jQuery position/offset
return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
}
}