Prevent a modal window from being closed by opening another

0

I have the following manners:

> first I open this:

<div id="my-id" class="uk-flex-top" uk-modal>
<i class="material-icons uk-text-success md-icon uk-form-file" id="btnCompr" href="#modal-full" uk-toggle>search </i>
    <div class="uk-modal-dialog uk-margin-auto-vertical"></div>
</div>
  

But I want to click on the button to open the second without closing the   first

<div id="<i class="material-icons uk-text-success md-icon uk-form-file" id="btnCompr" href="#modal-full" uk-toggle>search </i>" class="uk-modal-full" uk-modal>


 <div class="uk-modal-dialog">
        <button class="uk-modal-close-full uk-close-large" type="button" uk-close></button>
    </div>
</div>
    
asked by arglez35 23.03.2018 в 05:45
source

1 answer

0

The default behavior of the dialog of UIKit is to close when another is opened. In this SO answer they explain how to avoid it. Basically you have to add the property data-uk-modal="{target:'#modal1', modal: false} to the button or do it for javascript:

$(document).ready(function(){
    //Obtenemos la modal
    var modal2 = UIkit.modal("#modal2", {modal: false});
    //En el evento click del botón del modal1 abrimos el modal2
    $("#btn2").on("click",function(){
    modal2.show();
   });
});

Fiddle with attributes

Example with javascript

    
answered by 23.03.2018 / 09:36
source