Bootstrap open modal modal window causes page jitter resolution

Source: Internet
Author: User

When you use the bootstrap modal modal window component, the trigger will find that the page has a jitter behavior. This is because it hides the browser scroll bar, the page is equivalent to a wide, closed modal window, the page appears again scroll bar, the page has become narrower, this stretch of a contraction will make the page jitter phenomenon. My solution is very simple, is to kill the hidden scroll bar code. In total, delete the 6 lines of code in the Bootstrap.js file.

Take the uncompressed bootstrap.js file in the bootstrap3.3.6 version as an example.

First in 971 rows or so, delete these 3 sentences

    1. This. Checkscrollbar()
    2. This. Setscrollbar()
    3. This. $body. AddClass(' Modal-open ')

The second place is about 1081 lines, also delete 3 sentences

    1. That. $body. Removeclass(' Modal-open ')
    2. That. Resetadjustments()
    3. That. Resetscrollbar()

That's good. It's all about writing unimportant code, adding padding to the body without affecting the operation of other components.

Reprint to: http://www.dijing.me/bootstrap/10.html

Bootstrap open modal modal window causes page jitter resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.