teamAdding.js 819 B

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