joaopereirawd / animatedModal.js

animatedModal.js is a jQuery plugin to create a fullscreen modal with CSS3 transitions. You can use the transitions from animate.css or create your own transitions.
MIT License
962 stars 207 forks source link

How to add delay ? #62

Open DuudeXX8 opened 6 years ago

DuudeXX8 commented 6 years ago

I can't add any delay or setTimeout function please help.

$("#demo02").animatedModal({
                modalTarget:'modal-02',
                animatedIn:'lightSpeedIn',
                animatedOut:'bounceOutDown',
                color:'#3498db',
                // Callbacks
                beforeOpen: function() {
                    console.log("The animation was called");
                },           
                afterOpen: function() {
                    console.log("The animation is completed");
                }, 
                beforeClose: function() {
                    console.log("The animation was called");
                }, 
                afterClose: function() {
                    console.log("The animation is completed");
                }
            });
ericut commented 5 years ago

Hello, I have writen the following line in the animatedModal.js

setTimeout(function(){ closeModal() }, 5000);

put it right here, in the afterOpen() function:

function afterOpen () { settings.afterOpen(id); setTimeout(function(){ closeModal() }, 5000); }

sadiqsid commented 2 years ago

Replace afterclose() function with below code

   function afterClose() {
            setTimeout(function()
            {
                id.css({ 'z-index': settings.zIndexOut,'animation-fill-mode': settings.animationFillModeNone });
                settings.afterClose(); //afterClose
            }, 200);
        }