// Get references to the pop-up container and close button // Function to calculate the difference in days between two timestamps // Function to show or hide the popup based on visit history and closing action // Check if the popup has been closed before const popupClosed = localStorage.getItem('popupClosed'); // Boolean value stored as string // If the popup hasn't been closed, show it immediately popupContainer.style.display = 'flex'; // Show the pop-up sliderAdvertisement.style.display = 'none'; // Hide the slider while the pop-up is shown }, 5000); // Show after 5 seconds // Now apply the timing logic after the user has closed the popup // Calculate the days since the popup was last shown let showPopup = false; // Flag to track whether we should show the popup // Determine if the popup should be shown: // - First time visit (no lastShown value) // - Shown once per day for 3 days // - After 3 days, show every 3 days popupData.lastShown === null || // First time visitor (popupData.timesShown < 3 && daysSinceLastShown >= 1) || // Show once a day for first 3 days (popupData.timesShown >= 3 && daysSinceLastShown >= 3) // Show once every 3 days afterward showPopup = true; // The popup should be shown // Show the popup after 5 seconds popupContainer.style.display = 'flex'; // Show the pop-up sliderAdvertisement.style.display = 'none'; // Hide the slider while the pop-up is shown // Update popupData and store it // Show the slider if the popup is not shown // Ensure elements exist before using them // Call the function to handle popup display logic // Add click event listener to the close button popupContainer.style.display = 'none'; // Hide the pop-up sliderAdvertisement.style.display = 'flex'; // Show the slider advertisement when pop-up is closed localStorage.setItem('popupClosed', true); // Set popup as closed in localStorage // Reset timing logic after the popup is closed timesShown: 0 // Reset counter for daily/3-day logic

Recent Articles

Sort by

A Guide to Revolutionary ETF Investments on DeFi

A Guide to Revolutionary ETF Investments on DeFi

Welcome to our guide exploring a new era in decentralized finance! Here, we’re diving into

next crypto bull run
Crypto BasicsGuides

How to get prepared for the Next Crypto Bull Run?

GuidesNews and Updates

What is CROWD token? AND ITS USE CASES

How to Invest in CrowdSwap Liquidity Pools?
Guides

How to invest in CROWD/ARB pool

One of the investment methods in CROWD/ARB LP Farm is to utilize the CROWD token. In this opportunity, we suggest

How to Install MetaMask
Guides

How to Install MetaMask

MetaMask stands as one of the leading cryptocurrency wallets available today. It is a gateway to the Web 3 ecosystem

What is WBNB
Guides

How to invest in CROWD/BNB

One of the investment methods in CROWD/BNB LP Farm is to utilize the CROWD token. In this opportunity, we have

How to Invest in DeFi
Guides

How to Invest in DeFi

Imagine being transported back to the 1960s, when computers and the Internet weren’t widely accessible. At the same time, this

How to Identify a Scam Token in DeFi
Advanced Concepts

How to Identify a Scam Token in DeFi

The world of blockchain and cryptocurrencies is full of promises to make money fast. But it’s worth knowing if the

how to add bsc to metamask
Guides

How to add BSC to MetaMask

The world of cryptocurrency is full of opportunities, and the ability to seize them often hinges on accessibility and flexibility.

Get Ahead of the Curve – Subscribe for CrowdSwap Updates & Offers!

Join our newsletter to get the latest news, trading tips, and special offers straight to your inbox!

CrowdSwap Newsletter

Ready to Supercharge Your Financial Knowledge?

Drop your email, and we'll deliver the Ultimate DeFi Guide straight to your inbox! πŸš€