Tuesday, May 21, 2024
 Popular · Latest · Hot · Upcoming
-1
rated 0 times [  2] [ 3]  / answers: 1 / hits: 114375  / 11 Years ago, thu, february 6, 2014, 12:00:00

I have a problem, with a modal. I have a button on a page, that toggles the modal. When the modal shows up, the page jumps to top.



I have done everything I could to find a solution/etc, but I am really lost.



EDIT:



I have also tried with: $('#myModal').modal('show'); but it has the exact same effect.


More From » jquery

 Answers
5

When the modal opens a modal-open class is set to the <body> tag. This class sets overflow: hidden; to the body. Add this rule to your stylesheet to override the bootstrap.css style:



body.modal-open {
overflow: visible;
}


Now the scroll should stay in place.


[#72687] Wednesday, February 5, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zahrafrancisr

Total Points: 176
Total Questions: 105
Total Answers: 99

Location: Svalbard and Jan Mayen
Member since Sun, Sep 25, 2022
2 Years ago
;