teamAdding.js 711 B

123456789101112131415161718192021222324
  1. window.onload = function() {
  2. var popup = document.getElementById("myPopup");
  3. var span = document.getElementsByClassName("close")[0];
  4. var lastShown = localStorage.getItem("popupLastShown");
  5. if (lastShown === null || new Date().getTime() - parseInt(lastShown) > 60000) {
  6. // If not, show the popup
  7. window.setTimeout(function() {
  8. popup.style.display = "block";
  9. }, 3000); // Появление окна через 3 секунды
  10. localStorage.setItem("popupLastShown", new Date().getTime());
  11. }
  12. span.onclick = function() {
  13. popup.style.display = "none";
  14. }
  15. window.onclick = function(event) {
  16. if (event.target == popup) {
  17. popup.style.display = "none";
  18. }
  19. }
  20. }