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

optimism blockchain

Optimism Blockchain: Pioneering Ethereum’s Scalability Revolution

In the ever-evolving landscape of blockchain technology, scalability has emerged as a formidable challenge. Ethereum,

Bitcoin Halving Date
Crypto Basics

Bitcoin Halving Date: History and Impacts on BTC Price

USDC vs. USDT
Crypto BasicsGuides

USDC vs USDT: Which one is a better choice?

What Is Stablecoin Yield Farming?
Crypto Basics

What Is Stablecoin Yield Farming?

Stablecoins are one of the wisest inventions in the cryptocurrency market. As the name speaks, the price of stablecoins stays

How Do DeFi Aggregators Work?
Crypto Basics

How Do DeFi Aggregators Work?

Decentralized Finance (DeFi) protocols are ubiquitous, and some, like DEX aggregators, are terrifically attractive tools. Thanks to the aggregation of

APR vs. APY What’s the Difference
Crypto Basics

APY vs APR

In the ever-evolving decentralized finance (DeFi) landscape, staying informed is critical to maximizing your crypto investments. One concept that often

What is WBNB
Crypto Basics

What is WBNB?

WBNB (Wrapped BNB) is a form of BNB cryptocurrency that conducts transactions in the DeFi world if the transaction is

What is a smart contract?
Crypto Basics

What is a smart contract?

Imagine this scenario: On a cool fall evening in 2019, Jack and his son, Brad, were enjoying a drink in

What Is APY in Crypto?
Crypto Basics

What Is APY in Crypto?Β 

Earning passive income has always been an exciting way for financial market investors. To earn passive income in the cryptocurrency

What is daily compound interest?
Crypto Basics

What is daily compound interest?

The incredible growth of crypto-currencies lately had the world believe in the importance of investing in this wholly new and

impermanent loss
Crypto Basics

What is impermanent loss?

If you are familiar with Defi, you’ve almost heard about impermanent loss . Liquidity protocols allow any person with funds

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