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

What is a dApp browser, and how to use it?

What is a dApp browser, and how to use it?

The DeFi space is continuously evolving, and dApps are at the center. As crypto adoption

What is Liquid Staking? Enhancing Liquidity and Capital Efficiency in Staking
Crypto Basics

What is Liquid Staking? Enhancing Liquidity and Capital Efficiency in Staking

Deep dive into cross-chain swap methods
Crypto Basics

Deep dive into cross chain swap methods

yield farming vs staking
Crypto Basics

Yield Farming vs. Staking

In the world of decentralized finance (DeFi), two important ideas stand out: Yield Farming vs Staking. They may seem similar,

what is staking crypto?
Crypto Basics

What is staking crypto?

What Is DeFi Staking? DeFi, short for Decentralized Finance, is a relatively new term that has been making waves in

What Are Cross-Chain Swaps?
Crypto Basics

What Are Cross-Chain Swaps?

In the ever-evolving world of decentralized finance (DeFi), cross-chain swaps have emerged as a groundbreaking technology transforming how digital assets

How to Send Crypto?
Crypto Basics

How to Send Crypto?

Sending crypto to family and friends or for business transactions has never been easier. As a form of digital currency,

What Is Blockchain
Crypto Basics

What is Blockchain?

Blockchain technology has emerged as a revolutionary force in today’s digital landscape, redefining how we conduct transactions. Blockchain is a

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