Modal pop up automatically

I’ve searched the database - maybe I’m missing it, but I want my modal window to open automatically when people visit my site, then be able to close it. I have it now to where they have to click a button to open? Can any help? - Thanks - Jeff

Hi Jeff, is it possible for you to share your project link? You can trigger a modal window using the jQuery document.ready function, which you can paste to your BODY panel of the Custom Code section of the site settings.

<script type="text/javascript">

$(document).ready(function() {

    $('.modal-background').fadeIn();

  $('.close-modal').click(function() {
    $('.modal-background').fadeOut();
  });
});

</script> 

The above code will open the modal window when the page has loaded, yet allows your site visitor to also close the modal using the .close-modal class.

Hope that helps ! Cheers !

Cyberdave - thanks for the quick reply. Here’s my link. https://webflow.com/design/jeffcrume?preview=6b8a7aea0a6cb7e25fc27b56652685fd - I’m editing the script right now. It appears the script I was using was “click” instead of “ready.” ?

Is it possible to leave both scripts in, so if someone clicks to close our even pop up, but wants to access it again, they can click our “join jeff” button and the modal will open? - thanks

Hi, then make it:

<script type="text/javascript">

$(document).ready(function() {

    $('.modal-background').fadeIn(); 

$('.modal-link').click(function() {
    $('.modal-background').fadeIn();
  });

  $('.close-modal').click(function() {
    $('.modal-background').fadeOut();
  });
});

</script>

Too Cool Dave! Thanks! Works perfect. - Jeff

1 Like