Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Solve the scrolling exception when the bootstrap two-layer modal box is hidden

Shulou Source: shulou.com Published: 2022-06-03 06:33:23 10月01日 Update

Phenomenon:

Two-layer modal box, the bottom modal box cannot be scrolled after the upper modal box is hidden

Reason:

When the modal box is opened, the scroll bar of the parent label is hidden, and when it is closed, the scroll bar is restored and the scroll bar is added to the parent tag. Therefore, when there are two layers of modal boxes, when the upper layer is closed, the scroll bar is generally added back to body, resulting in the bottom mode box not scrolling.

Solution:

Continue to hide the scroll bar of body while the top modal box is hidden

Code:

$("# frontModal") .on ("hidden.bs.modal", function () {$('body'). AddClass (' modal-open')})

Tags: Mode time upper layer bottom layer label code method cause phenomenon top layer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Apple Linux Xiaomi vpn