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

Decentralized Autonomous Organizations

Decentralized Autonomous Organizations (DAOs): Unlocking the Future of Web3

In 2022, a global collective of artists united through a digital platform to create groundbreaking

optimism blockchain
Crypto Basics

Optimism Blockchain: Pioneering Ethereum’s Scalability Revolution

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

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

MANA Price Prediction
Crypto Basics

MANA Price Prediction

In the realm of cryptocurrencies, few have captured the imagination quite like MANA (Decentraland). As a virtual reality platform built

what is a defi wallet
Crypto Basics

What Is a DeFi Wallet?

Introduction Decentralized finance (DeFi) has emerged as a disruptive force in the world of finance, offering new opportunities for individuals

GALA Price Prediction
Crypto Basics

GALA Price Prediction

We’re about to dive into the world of crypto and gaming, two things that go together like peanut butter and

What is arbitrum, and how it works
Crypto Basics

What is Arbitrum, and how it works

Arbitrum is one of the leading layer two solutions for Ethereum. Layer 2 solutions aim to address the scalability and

AAVE price prediction
Crypto Basics

AAVE Price Prediction

What is AAVE? Are you ready for a wild ride through the world of cryptocurrency? Buckle up, because we’re about

What is a DEX?
Crypto Basics

What is DEX or Decentralized Exchange?

In simple terms, a Decentralized Exchange, or DEX, is like an online marketplace for trading cryptocurrencies. Now, let’s delve deeper

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

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