Yuzayu UIkit, there is a modalka, but it is called through the incomprehensible to me uk-toggle and is actually associated with the modalke by the tag uk-modal. I'm trying to call this very modalka in 5 seconds after loading the site, but in any way. Even if uk-toggle is removed from the normal link, the modalki call will not work ... Can you tell me how to solve it? Can somehow cause an attribute, is it possible? Example - https://jsfiddle.net/sr9eg2xe/

<a href="#modal-example" uk-toggle>Open</a> <div id="modal-example" class="uk-flex-top" uk-modal> <div class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical"> </div> </div> 

    1 answer 1

    In your case, the elements are linked using the id attribute, and the uk-toggle and uk-modal attributes bind the framework handlers to the elements.

    If you look at the modal classes in the open state, then it will have the classes uk-modal uk-flex uk-open .

    In the code:

     var modal = document.getElementById('modal-example'); setTimeout(function(){ modal.__uikit__.modal.show() }, 5000); 

    https://jsfiddle.net/sr9eg2xe/5/

    • To the point, this is what I needed. Thank you very much! - deasmont
    • Can you still tell me how to stick an animation into this code when the window appears? - deasmont
    • instead of adding classes, it is better to pull the framework method, like this: modal.__uikit__.modal.show() . then the animation will be - Raul Rojas
    • Mm, not bad, thanks again. It will come in handy for me in the future - deasmont