1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-24 14:13:06 +02:00
This commit is contained in:
fat
2015-05-13 13:43:56 -07:00
parent 7ef0e52fd0
commit b0d142334f
7 changed files with 95 additions and 14 deletions

5
js/dist/modal.js vendored
View File

@@ -31,6 +31,7 @@ var Modal = (function ($) {
var Default = {
backdrop: true,
keyboard: true,
focus: true,
show: true
};
@@ -206,14 +207,14 @@ var Modal = (function ($) {
$(this._element).addClass(ClassName.IN);
this._enforceFocus();
if (this._config.focus) this._enforceFocus();
var shownEvent = $.Event(Event.SHOWN, {
relatedTarget: relatedTarget
});
var transitionComplete = function transitionComplete() {
_this2._element.focus();
if (_this2._config.focus) _this2._element.focus();
$(_this2._element).trigger(shownEvent);
};

File diff suppressed because one or more lines are too long

28
js/dist/scrollspy.js vendored
View File

@@ -28,7 +28,8 @@ var ScrollSpy = (function ($) {
var Default = {
offset: 10,
method: 'auto'
method: 'auto',
target: ''
};
var Event = {
@@ -45,8 +46,9 @@ var ScrollSpy = (function ($) {
var Selector = {
DATA_SPY: '[data-spy="scroll"]',
ACTIVE: '.active',
LI: 'li',
LI_DROPDOWN: 'li.dropdown',
LI: 'li'
NAV_ANCHORS: '.nav li > a'
};
var OffsetMethod = {
@@ -66,8 +68,8 @@ var ScrollSpy = (function ($) {
this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = $.extend({}, Default, config);
this._selector = '' + (this._config.target || '') + ' .nav li > a';
this._config = this._getConfig(config);
this._selector = '' + this._config.target + ' ' + Selector.NAV_ANCHORS;
this._offsets = [];
this._targets = [];
this._activeTarget = null;
@@ -137,10 +139,26 @@ var ScrollSpy = (function ($) {
this._scrollHeight = null;
}
}, {
key: '_getScrollTop',
key: '_getConfig',
// private
value: function _getConfig(config) {
config = $.extend({}, Default, config);
if (typeof config.target !== 'string') {
var id = $(config.target).attr('id');
if (!id) {
id = Util.getUID(NAME);
$(config.target).attr('id', id);
}
config.target = '#' + id;
}
return config;
}
}, {
key: '_getScrollTop',
value: function _getScrollTop() {
return this._scrollElement === window ? this._scrollElement.scrollY : this._scrollElement.scrollTop;
}

File diff suppressed because one or more lines are too long