A responsive Black Friday promotional popup featuring referral rewards, an animated modal design, and a tooltip-based withdrawal notice. The popup appears only once every 6 hours using localStorage, includes a close button, smooth fade-in animation, and mobile-friendly layout. Built using HTML, CSS, and vanilla JavaScript.
<div id="blackFridayPopup" class="popup">
<div class="popup-content">
<span class="close-btn">×</span>
<h2>{{ __('Black Friday Referral Bonus!') }}</h2>
<p>{{ __('Invite your friends & earn rewards:') }}</p>
<ul>
<li><strong>$0.50</strong> {{ __('for you per referral') }}</li>
<li><strong>$2.00</strong> {{ __('for your friend') }}</li>
</ul>
<p class="offer-deadline">
{{ __('Offer valid until') }} <strong>{{ __('30th November') }}</strong>
</p>
<a href="{{ route('user.referral') }}" class="btn">{{ __('Refer Now') }}</a>
<button class="withdraw-btn" id="withdrawBtn">
<i class="icon-info-circle"></i> {{ __('Withdraw Info') }}
<span class="tooltiptext">
{{ __('Only verified referrals will be counted for withdrawal. Unverified referral bonuses will be deducted.') }}
</span>
</button>
</div>
</div>
<style>
/* Overlay */
.popup {
display: none; /* hidden by default */
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(195, 75, 154, 0.85);
justify-content: center;
align-items: center;
z-index: 9999;
animation: fadeIn 0.5s;
}
/* Popup box */
.popup-content {
background: #fff;
border-radius: 15px;
width: 95%;
max-width: 450px;
padding: 35px 25px;
text-align: center;
position: relative;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
box-shadow: 0 15px 40px rgba(0,0,0,0.25);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.popup-content:hover {
transform: translateY(-5px);
box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
/* Close button */
.close-btn {
position: absolute;
top: 15px;
right: 20px;
font-size: 24px;
cursor: pointer;
color: #c34b9a;
transition: color 0.3s;
}
.close-btn:hover {
color: #341BAF;
}
/* Headings */
.popup-content h2 {
color: #c34b9a;
font-size: 26px;
margin-bottom: 15px;
}
.popup-content p, .popup-content ul {
color: #333;
margin-bottom: 15px;
line-height: 1.6;
}
.popup-content ul {
list-style: none;
padding: 0;
}
.popup-content ul li::before {
margin-right: 10px;
color: #c34b9a;
}
/* Offer deadline */
.offer-deadline {
font-weight: bold;
color: #FF3B30;
margin-bottom: 25px;
}
/* Buttons */
.popup-content .btn,
.popup-content .withdraw-btn {
display: inline-block;
padding: 12px 30px;
border-radius: 50px;
font-weight: bold;
font-size: 16px;
text-decoration: none;
transition: all 0.3s ease;
margin: 10px 5px;
cursor: pointer;
}
.popup-content .btn {
background: linear-gradient(90deg, #c34b9a, #7C5FFF);
color: #fff;
border: none;
}
.popup-content .btn:hover {
background: linear-gradient(90deg, #7C5FFF, #c34b9a);
transform: scale(1.05);
}
.popup-content .withdraw-btn {
background: #fff;
color: #c34b9a;
border: 2px solid #c34b9a;
position: relative;
}
/* Tooltip */
.withdraw-btn .tooltiptext {
visibility: hidden;
width: 220px;
background-color: #c34b9a;
color: #fff;
text-align: left;
padding: 10px;
border-radius: 8px;
position: absolute;
z-index: 1;
bottom: 130%;
left: 50%;
transform: translateX(-50%);
opacity: 0;
transition: opacity 0.3s;
font-size: 13px;
line-height: 1.4;
}
.withdraw-btn:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
/* Fade-in animation */
@keyframes fadeIn {
from {opacity: 0;}
to {opacity: 1;}
}
/* Mobile responsiveness */
@media (max-width: 480px) {
.popup-content {
padding: 25px 15px;
}
.popup-content h2 {
font-size: 22px;
}
.popup-content .btn,
.popup-content .withdraw-btn {
padding: 10px 20px;
font-size: 14px;
}
.withdraw-btn .tooltiptext {
width: 180px;
}
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
const popup = document.getElementById('blackFridayPopup');
const closeBtn = document.querySelector('#blackFridayPopup .close-btn');
const popupKey = 'blackFridayPopupSeen';
const sixHours = 6 * 60 * 60 * 1000; // 6 hours in milliseconds
const now = new Date().getTime();
const lastSeen = localStorage.getItem(popupKey);
// Show popup only if 6 hours passed or never shown
if (!lastSeen || now - lastSeen > sixHours) {
popup.style.display = 'flex';
} else {
popup.style.display = 'none';
}
// Close popup and save timestamp
function closePopupHandler() {
popup.style.display = 'none';
localStorage.setItem(popupKey, new Date().getTime());
}
closeBtn.addEventListener('click', closePopupHandler);
// Optional: click outside popup to close
window.addEventListener('click', function(e) {
if (e.target === popup) {
closePopupHandler();
}
});
});
</script>
Your email address will not be published. Required fields are marked *