26 lines
1.4 KiB
PHP
26 lines
1.4 KiB
PHP
<a href="https://forum.rusgrain.org?erid=2VSb5zKAzHv" target="_blank" style="display: block; width: 240px; height: 400px; text-decoration: none; margin: 0 auto;">
|
|
<div id="banner" class="banner-left" style="position: relative; width: 100%; height: 100%; background: url('https://agroexpert.press/wp-content/uploads/2025/02/agroekspert-480h800-.jpg') no-repeat center/cover;">
|
|
<div id="countdown" style="position: absolute; bottom: 24px; right: 0px; font-family: Impact, Charcoal, sans-serif; font-size: 15px; text-transform: uppercase; background-color: green; color: white; padding: 6px 15px 6px 19px; border-bottom: 2px solid white;">
|
|
Осталось 00 дней
|
|
</div>
|
|
</div>
|
|
</a>
|
|
|
|
<script>
|
|
function getDayText(num) {
|
|
if (num % 10 === 1 && num % 100 !== 11) return "день";
|
|
if ([2, 3, 4].includes(num % 10) && ![12, 13, 14].includes(num % 100)) return "дня";
|
|
return "дней";
|
|
}
|
|
|
|
function updateCountdown() {
|
|
const eventDate = new Date('2025-05-28'); // Дата события
|
|
const now = new Date();
|
|
const diff = Math.max(0, Math.ceil((eventDate - now) / (1000 * 60 * 60 * 24))); // Разница в днях
|
|
|
|
document.getElementById('countdown').innerText = `Осталось ${diff} ${getDayText(diff)}`;
|
|
}
|
|
|
|
updateCountdown();
|
|
setInterval(updateCountdown, 86400000); // Обновление раз в день
|
|
</script> |