// 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

Trading Campaign rules

Weekly Trading Contest Rules

Dear CrowdSwap community: To further strengthen our newly upgraded cross-chain solution and increase volume and

CrowdSwap and Rootstock Partnership
News and Updates

CrowdSwap and Rootstock Partnership

The Best Cross-Chain Bridge, Perfect for Transactions Up to $500 and Beyond
News and Updates

The Best Cross-Chain Bridge, Perfect for Transactions Up to $500 and Beyond

What does it mean to burn tokens
Crypto Basics

What Does Token Burning Mean?

Introduction Have you ever found yourself scratching your head, wondering how Bitcoin, the king of cryptocurrencies, skyrocketed in value in

Long-term holders ranking announcement (January 11th update)
News and Updates

Weekly LTH Update, Feb 13th

It’s just one week until we pack LTH Season 1 bags and send it on its way with good wishes

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

Weekly LTH Update, Feb 6th
News and Updates

Weekly LTH Update, Feb 6th

Sands of time slowly grind down the narrow throat, marking the two-week separation to the end of the LTH (long-term

LTH Update, January 30th
News and Updates

LTH Update, January 30th

The LTH program (Long-term CROWD holders) has evidently sat well with you guys, and your feedback and fever for the

Five Best Crypto to Invest in 2023
Market trends

Five Best Crypto to Invest in 2023

2023 is right around the corner. And for those whose new year’s resolution is to become more crypto-savvy and dive

Long-term holders ranking announcement (January 11th update)
News and Updates

LTH Update, January 22nd

It’s been a week since the last update and it’s surely crossed your mind once or twice: When is the

CrowDEX: How We Became a DEX
News and Updates

CrowDEX: How We Became a DEX

For a time, we’ve been testing out the waters of creating liquidity pools and providing services to projects eager to

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! πŸš€