mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
Fix Modal documentation about _handleUpdate method + move to public scope (#21877)
Fix Modal documentation about _handleUpdate method + move to public scope
This commit is contained in:
parent
37f438910f
commit
3f247a42f2
2 changed files with 11 additions and 6 deletions
|
@ -410,7 +410,7 @@ For modals that simply appear rather than fade in to view, remove the `.fade` cl
|
||||||
|
|
||||||
### Dynamic heights
|
### Dynamic heights
|
||||||
|
|
||||||
If the height of a modal changes while it is open, you should call `$('#myModal').data('bs.modal').handleUpdate()` to readjust the modal's position in case a scrollbar appears.
|
If the height of a modal changes while it is open, you should call `$('#myModal').data('bs.modal').handleUpdate()` or `$('#myModal').modal('handleUpdate')` to readjust the modal's position in case a scrollbar appears.
|
||||||
|
|
||||||
### Accessibility
|
### Accessibility
|
||||||
|
|
||||||
|
@ -575,6 +575,12 @@ Manually hides a modal. **Returns to the caller before the modal has actually be
|
||||||
|
|
||||||
{% highlight js %}$('#myModal').modal('hide'){% endhighlight %}
|
{% highlight js %}$('#myModal').modal('hide'){% endhighlight %}
|
||||||
|
|
||||||
|
#### `.modal('handleUpdate')`
|
||||||
|
|
||||||
|
Manually readjust the modal's position if the height of a modal changes while it is open (i.e. in case a scrollbar appears).
|
||||||
|
|
||||||
|
{% highlight js %}$('#myModal').modal('handleUpdate'){% endhighlight %}
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
Bootstrap's modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the `<div class="modal">`).
|
Bootstrap's modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the `<div class="modal">`).
|
||||||
|
|
|
@ -215,6 +215,9 @@ const Modal = (($) => {
|
||||||
this._scrollbarWidth = null
|
this._scrollbarWidth = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleUpdate() {
|
||||||
|
this._adjustDialog()
|
||||||
|
}
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
||||||
|
@ -296,7 +299,7 @@ const Modal = (($) => {
|
||||||
|
|
||||||
_setResizeEvent() {
|
_setResizeEvent() {
|
||||||
if (this._isShown) {
|
if (this._isShown) {
|
||||||
$(window).on(Event.RESIZE, (event) => this._handleUpdate(event))
|
$(window).on(Event.RESIZE, (event) => this.handleUpdate(event))
|
||||||
} else {
|
} else {
|
||||||
$(window).off(Event.RESIZE)
|
$(window).off(Event.RESIZE)
|
||||||
}
|
}
|
||||||
|
@ -401,10 +404,6 @@ const Modal = (($) => {
|
||||||
// todo (fat): these should probably be refactored out of modal.js
|
// todo (fat): these should probably be refactored out of modal.js
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
_handleUpdate() {
|
|
||||||
this._adjustDialog()
|
|
||||||
}
|
|
||||||
|
|
||||||
_adjustDialog() {
|
_adjustDialog() {
|
||||||
const isModalOverflowing =
|
const isModalOverflowing =
|
||||||
this._element.scrollHeight > document.documentElement.clientHeight
|
this._element.scrollHeight > document.documentElement.clientHeight
|
||||||
|
|
Loading…
Add table
Reference in a new issue