Fix Modal documentation about _handleUpdate method + move to public scope
### 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
{% 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
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">`).
this._scrollbarWidth = null
}
+ handleUpdate() {
+ this._adjustDialog()
+ }
// private
_setResizeEvent() {
if (this._isShown) {
- $(window).on(Event.RESIZE, (event) => this._handleUpdate(event))
+ $(window).on(Event.RESIZE, (event) => this.handleUpdate(event))
} else {
$(window).off(Event.RESIZE)
}
// todo (fat): these should probably be refactored out of modal.js
// ----------------------------------------------------------------------
- _handleUpdate() {
- this._adjustDialog()
- }
-
_adjustDialog() {
const isModalOverflowing =
this._element.scrollHeight > document.documentElement.clientHeight