Top Stories

BKT Appoints New Leaders to Drive OEM Growth in APAC and MEA Regions

December 17, 2024

NEXEN TIRE Partners with FC Bayern to Expand Global Brand Presence

December 17, 2024

Business

Happy Christmas & New Year Message from Tyre News Media

December 20, 2024

Yokohama Embarks on Ambitious “1-Year Plant” Project in China

December 20, 2024

Tyre Wholesale

Fleet News

Happy Christmas & New Year Message from Tyre News Media

December 20, 2024

Elite Garages Expands with 18th Workshop in Fareham

December 20, 2024
// Function to show the popup with a fade-in animation function showPopup() { const popup = document.getElementById('popupLoader'); if (popup) { popup.style.display = 'block'; popup.style.opacity = '0'; let opacity = 0; const fadeIn = setInterval(() => { if (opacity < 1) { opacity += 0.1; popup.style.opacity = opacity.toString(); } else { clearInterval(fadeIn); } }, 30); } } // Function to set the popup display time in localStorage function setPopupDisplayTime() { try { localStorage.setItem('popupLastShown', new Date().getTime().toString()); } catch (e) { console.error('Local storage is not available:', e); } } // Function to check if the popup should be shown function shouldShowPopup() { try { const lastShown = localStorage.getItem('popupLastShown'); if (!lastShown) { return true; } const currentTime = new Date().getTime(); const timeDifference = currentTime - parseInt(lastShown, 10); const daysSinceLastShown = timeDifference / (1000 * 3600 * 24); // Change this value to adjust how often the popup appears (in days) const daysBeforeShowingAgain = 3; return daysSinceLastShown >= daysBeforeShowingAgain; } catch (e) { console.error('Error checking popup display condition:', e); return true; // Show popup if there's an error } } // Main function to handle popup display function handlePopupDisplay() { if (shouldShowPopup()) { showPopup(); setPopupDisplayTime(); } } // Event listener for when the DOM is fully loaded document.addEventListener('DOMContentLoaded', handlePopupDisplay);