Search   
zStudio CMS Help

One-Time Pop Up

Example:

IMPORTANT COVID-19 INFORMATION

 

 

 

 

1. Create Popup Block plugin using PLUGINS tool. 

2. Add required style to the page header.

3. Add this script to the page footer:

 

<s cript>

 // Show pop-up only one time in hour


window.setTimeout(function(){ 

  // First check, if localStorage is supported.

  if (window.localStorage) {

    // Get the expiration date of the previous popup.

    var nextPopup = localStorage.getItem( 'nextNewsletter' );


    if (nextPopup > new Date()) {

      return;

    }


    // Store the expiration date of the current popup in localStorage.

    var expires = new Date();

    expires = expires.setHours(expires.getHours() + 1);


    localStorage.setItem( 'nextNewsletter', expires );

  }


  document.getElementsByClassName('ExpDivTitle')[0].onclick();

}, 3000);

</script>