1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| <div class="modal fade" id="modalPatient" tabindex="-1" role="dialog" aria-labelledby="modalPatientLabel" aria-hidden="true" >
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
<a class="btn btn-default glyphicon glyphicon-plus " role="button" data-toggle="modal_multi" data-target="#modalPatient" data-remote="{{ path('patient_correspondant_new') }}" data-js="refreshCorrespondants"></a>
...
$(document).on({
'show.bs.modal': function (e)
var zIndex = 1040 + (10 * $('.modal:visible').length);
$(this).css('z-index', zIndex);
setTimeout(function() {
$('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
}, 0);
},
'hidden.bs.modal': function() {
if ($('.modal:visible').length > 0) {
// restore the modal-open class to the body element, so that scrolling works
// properly after de-stacking a modal.
setTimeout(function() {
$(document.body).addClass('modal-open');
}, 0);
}
}
}, '.modal');
//$('a[data-toggle="modal"]').on('click', function(e) {
$(document).on('click', 'a[data-toggle="modal_multi"]', function(e) {
var target_modal = $(e.currentTarget).data('target');
$(target_modal).data('js',$(e.currentTarget).data('js'))
// also get the remote content's URL
var remote_content = $(e.currentTarget).data('remote');
var modal = $(target_modal);
var modalContent = $(target_modal + ' .modal-content');
modalContent.load( remote_content, function() {
modal.modal();
});
return false;
}); |
Partager