0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-28 20:52:21 +01:00
This commit is contained in:
Mark Otto 2015-08-17 00:12:58 -07:00
commit 461b37b034
12 changed files with 35 additions and 29 deletions

View File

@ -1454,7 +1454,7 @@ var Dropdown = (function ($) {
this.setAttribute('aria-expanded', 'true');
$(parent).toggleClass(ClassName.OPEN);
$(parent).trigger(Event.SHOWN, relatedTarget);
$(parent).trigger($.Event(Event.SHOWN, relatedTarget));
return false;
}
@ -1525,7 +1525,7 @@ var Dropdown = (function ($) {
toggles[i].setAttribute('aria-expanded', 'false');
$(_parent).removeClass(ClassName.OPEN).trigger(Event.HIDDEN, relatedTarget);
$(_parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget));
}
}
}, {
@ -1669,6 +1669,7 @@ var Modal = (function ($) {
};
var ClassName = {
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
BACKDROP: 'modal-backdrop',
OPEN: 'modal-open',
FADE: 'fade',
@ -1679,7 +1680,7 @@ var Modal = (function ($) {
DIALOG: '.modal-dialog',
DATA_TOGGLE: '[data-toggle="modal"]',
DATA_DISMISS: '[data-dismiss="modal"]',
SCROLLBAR_MEASURER: 'modal-scrollbar-measure'
FIXED_CONTENT: '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
};
/**
@ -2029,7 +2030,7 @@ var Modal = (function ($) {
}, {
key: '_setScrollbar',
value: function _setScrollbar() {
var bodyPadding = parseInt($(document.body).css('padding-right') || 0, 10);
var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
this._originalBodyPadding = document.body.style.paddingRight || '';
@ -2047,7 +2048,7 @@ var Modal = (function ($) {
value: function _getScrollbarWidth() {
// thx d.walsh
var scrollDiv = document.createElement('div');
scrollDiv.className = Selector.SCROLLBAR_MEASURER;
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);

File diff suppressed because one or more lines are too long

View File

@ -133,7 +133,7 @@
this.setAttribute('aria-expanded', 'true');
$(parent).toggleClass(ClassName.OPEN);
$(parent).trigger(Event.SHOWN, relatedTarget);
$(parent).trigger($.Event(Event.SHOWN, relatedTarget));
return false;
}
@ -204,7 +204,7 @@
toggles[i].setAttribute('aria-expanded', 'false');
$(_parent).removeClass(ClassName.OPEN).trigger(Event.HIDDEN, relatedTarget);
$(_parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget));
}
}
}, {

View File

@ -74,6 +74,7 @@
};
var ClassName = {
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
BACKDROP: 'modal-backdrop',
OPEN: 'modal-open',
FADE: 'fade',
@ -84,7 +85,7 @@
DIALOG: '.modal-dialog',
DATA_TOGGLE: '[data-toggle="modal"]',
DATA_DISMISS: '[data-dismiss="modal"]',
SCROLLBAR_MEASURER: 'modal-scrollbar-measure'
FIXED_CONTENT: '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
};
/**
@ -434,7 +435,7 @@
}, {
key: '_setScrollbar',
value: function _setScrollbar() {
var bodyPadding = parseInt($(document.body).css('padding-right') || 0, 10);
var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
this._originalBodyPadding = document.body.style.paddingRight || '';
@ -452,7 +453,7 @@
value: function _getScrollbarWidth() {
// thx d.walsh
var scrollDiv = document.createElement('div');
scrollDiv.className = Selector.SCROLLBAR_MEASURER;
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);

View File

@ -15,6 +15,8 @@ Add small overlay content, like those found in iOS, to any element for housing s
Things to know when using the popover plugin:
- Popovers rely on on the 3rd party library [tehter](http://github.hubspot.com/tether/) for positioning. You must include [tether.min.js](https://github.com/HubSpot/tether/blob/master/dist/js/tether.min.js) before bootstrap.js in order for popovers to work!
- Popovers require the [tooltip plugin](/components/tooltips) as a dependency.
- Popovers are opt-in for performance reasons, so **you must initialize them yourself**.
- Zero-length `title` and `content` values will never show a popover.

View File

@ -15,6 +15,7 @@ Inspired by the excellent Tipsy jQuery plugin written by Jason Frame. Tooltips a
Things to know when using the tooltip plugin:
- Tooltips rely on on the 3rd party library [tehter](http://github.hubspot.com/tether/) for positioning. You must include [tether.min.js](https://github.com/HubSpot/tether/blob/master/dist/js/tether.min.js) before bootstrap.js in order for tooltips to work!
- Tooltips are opt-in for performance reasons, so **you must initialize them yourself**.
- Tooltips with zero-length titles are never displayed.
- Specify `container: 'body'` to avoid rendering problems in more complex components (like our input groups, button groups, etc).

4
js/dist/dropdown.js vendored
View File

@ -116,7 +116,7 @@ var Dropdown = (function ($) {
this.setAttribute('aria-expanded', 'true');
$(parent).toggleClass(ClassName.OPEN);
$(parent).trigger(Event.SHOWN, relatedTarget);
$(parent).trigger($.Event(Event.SHOWN, relatedTarget));
return false;
}
@ -187,7 +187,7 @@ var Dropdown = (function ($) {
toggles[i].setAttribute('aria-expanded', 'false');
$(_parent).removeClass(ClassName.OPEN).trigger(Event.HIDDEN, relatedTarget);
$(_parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget));
}
}
}, {

File diff suppressed because one or more lines are too long

7
js/dist/modal.js vendored
View File

@ -57,6 +57,7 @@ var Modal = (function ($) {
};
var ClassName = {
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
BACKDROP: 'modal-backdrop',
OPEN: 'modal-open',
FADE: 'fade',
@ -67,7 +68,7 @@ var Modal = (function ($) {
DIALOG: '.modal-dialog',
DATA_TOGGLE: '[data-toggle="modal"]',
DATA_DISMISS: '[data-dismiss="modal"]',
SCROLLBAR_MEASURER: 'modal-scrollbar-measure'
FIXED_CONTENT: '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
};
/**
@ -417,7 +418,7 @@ var Modal = (function ($) {
}, {
key: '_setScrollbar',
value: function _setScrollbar() {
var bodyPadding = parseInt($(document.body).css('padding-right') || 0, 10);
var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
this._originalBodyPadding = document.body.style.paddingRight || '';
@ -435,7 +436,7 @@ var Modal = (function ($) {
value: function _getScrollbarWidth() {
// thx d.walsh
var scrollDiv = document.createElement('div');
scrollDiv.className = Selector.SCROLLBAR_MEASURER;
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);

File diff suppressed because one or more lines are too long

View File

@ -113,7 +113,7 @@ const Dropdown = (($) => {
this.setAttribute('aria-expanded', 'true')
$(parent).toggleClass(ClassName.OPEN)
$(parent).trigger(Event.SHOWN, relatedTarget)
$(parent).trigger($.Event(Event.SHOWN, relatedTarget))
return false
}
@ -184,7 +184,7 @@ const Dropdown = (($) => {
$(parent)
.removeClass(ClassName.OPEN)
.trigger(Event.HIDDEN, relatedTarget)
.trigger($.Event(Event.HIDDEN, relatedTarget))
}
}

View File

@ -55,17 +55,18 @@ const Modal = (($) => {
}
const ClassName = {
BACKDROP : 'modal-backdrop',
OPEN : 'modal-open',
FADE : 'fade',
IN : 'in'
SCROLLBAR_MEASURER : 'modal-scrollbar-measure',
BACKDROP : 'modal-backdrop',
OPEN : 'modal-open',
FADE : 'fade',
IN : 'in'
}
const Selector = {
DIALOG : '.modal-dialog',
DATA_TOGGLE : '[data-toggle="modal"]',
DATA_DISMISS : '[data-dismiss="modal"]',
SCROLLBAR_MEASURER : 'modal-scrollbar-measure'
FIXED_CONTENT : '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
}
@ -414,7 +415,7 @@ const Modal = (($) => {
_setScrollbar() {
let bodyPadding = parseInt(
$(document.body).css('padding-right') || 0,
$(Selector.FIXED_CONTENT).css('padding-right') || 0,
10
)
@ -432,7 +433,7 @@ const Modal = (($) => {
_getScrollbarWidth() { // thx d.walsh
let scrollDiv = document.createElement('div')
scrollDiv.className = Selector.SCROLLBAR_MEASURER
scrollDiv.className = ClassName.SCROLLBAR_MEASURER
document.body.appendChild(scrollDiv)
let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
document.body.removeChild(scrollDiv)