Streaming live at 10am (PST)

Fade out modal window after div appears


#1

Hey

So I have this form set up inside the modal window. After you fill in the form and success message appears I would like to fade out modal window with 5 second delay.

I added the .success class to success message and this code before /body:

<script type="text/javascript">

$(window).load(function() {
$('.success')
    setTimeout(function(){ $('.modal-background').fadeOut() }, 5000);
    });

But all it does it closes modal window 5 seconds after I open it (doesn't wait for the success message to appear).

Ofcourse the website link http://flittigbi.webflow.com/
and troubleshooting link https://webflow.com/design/flittigbi?preview=43c64b32ebdfcbba24aaee5fa082d8e9


#2

Hmm...
1. You use $(window).load() function that is triggered when everything including images) is loaded on the site.
2. You are reffering to object $('.success') without action attached.
3. You misunderstood what you wanted to achieve. I think you should do it in a different way. I'm not sure how to be honest...

$('.success').load(function() {
  $('.modal-background').delay(5000).fadeOut();
});

Maybe something like this? I don't know...


#3