Answer the question
In order to leave comments, you need to log in
How to make a call from a modal window to another modal window in Bootstrap3?
For example, there is a "description" button
<a href="#description-training" data-toggle="modal">описание</a>
<a href="#modalOrderCall" data-toggle="modal" data-dismiss="modal" >Заказать звонок</a>
Answer the question
In order to leave comments, you need to log in
Try to open the second window not immediately, but by timeout. You can even use a zero timeout.
/* close modal */
setTimeout(function() {/* open modal */}, 0)
I had to click on this code
('#getModal').click(function(){
$('#description-training').modal('hide');
setTimeout(function() {$('#modalOrderCall').modal('show');}, 500)
return false;
})
But to be honest, I don't really like the twitch effect. Since when you open it, the screen is first cut off and a dimming background appears, then the screen falls back into place and the background disappears, and then it appears again, some kind of jerky effect.
And what should be used to accomplish such a task?
This is ideal, as I imagine it, so that the background does not disappear at the moment of changing windows, but simply the modal window disappears, for example, with a fade, and another one rises in its place.
Since the problem is that the "modal-open" class disappears from the body. You can attach a code to the "shown.bs.modal" event (fired after opening) of the 2nd modal window that will add the "modal-open" class to the body:
$('#modal2').on('shown.bs.modal', function (event) {
$('body').addClass('modal-open');
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question