So, I'm using this code to open another modal window in a current opened modal window:
<a onclick=\"$('#login').modal('hide');$('#lost').modal('show');\" href='#'>Click</a>
What happens is, that for like 500ms the scrollbar will duplicate. I guess because the current modal is still fading out. However it looks very un-smooth and stuttering.
I would appreciate any suggestions to solve this issue.
Also, is the way building this in an onclick-event unprofessional?
I'm working with the bootstrap version 3.0.
Edit: I guess it's neccesary to reduce the time of fading out a modal. How is this possible?
I also had some trouble with my scrollable modals, so I did something like this:
It will serve for any modal whithin a modal that comes to appear. Note that the first its closed so the second can appear. No changes in the Bootstrap structure.
try this
For someone who use bootstrap 4 https://jsfiddle.net/helloroy/tmm9juoh/
Modals in Modal:
Close the first Bootstrap modal and open the new modal dynamically.
Working on a project that has a lot of modals calling other modals and a few HTML guys that might not know to initiate it everytime for each button. Came to a similar conclusion as @gmaggio, begrudgingly after going the long way around first.
EDIT: Now supports modals called via javascript.
EDIT: Opening a scrolling modal from another modal now works.
Just place the modal calling button in as normal, and if it is picked up to be inside a modal, it will close the current one first before opening the one specified in data-target. Note that
relatedTarget
is provided by Bootstrap.I also added the following to smooth out the fading a bit: I am sure more can be done though.