Сейчас узнаем, какой подарок выпадет именно Вам
Крутите колесо
Ура, вы выиграли!
Ваш приз:
Годовой доступ
к видео на mo-ti -20%
по промокоду T19RAY
Промокод действителен 3 дня

Оформить доступ с промокодом
100
Смена блока по времени суток в Tilda
OUR COMPANY
c 7 до 12
Anything you've even dreamed about is possible to realise just at the moment when you decided to win.
OUR COMPANY
c 12 до 19
Anything you've even dreamed about is possible to realise just at the moment when you decided to win.
OUR COMPANY
c 19 до 24
Anything you've even dreamed about is possible to realise just at the moment when you decided to win.
OUR COMPANY
c 0 до 7
Anything you've even dreamed about is possible to realise just at the moment when you decided to win.

Смена блока по времени суток в Tilda

Пример позволяет показывать нужный блок в разное время суток
1
Создали 4 блока для замены, задали им классы
uc-time-block1
uc-time-block2
uc-time-block3
uc-time-block4
2
Настроили логику видимости блоков

Блок - 1 пусть показывается с 7-12
Блок - 2 пусть показывается с 12-19
Блок - 3 пусть показывается с 19-24
Блок - 4 пусть показывается с 0-7
3
Добавили код на страницу в блок Другое - Т123
Библиотека для примера
<script>
document.addEventListener("DOMContentLoaded", function() {
    (function () {
    
    const timeBlocks = document.querySelectorAll('div[class*="uc-time-block"]');
    
    //ПРоверяем, если ли 4 этих блока на странице
    if(timeBlocks.length==4){
    
        function checkTime(){    
            const  timeZone = +3; // Разница во времени мск
            const  day = new Date();
            const  utc = day.getTime() + (day.getTimezoneOffset() * 60000);
            const  DateOffset = new Date(utc + (3600000*timeZone));
            const  hour = DateOffset.getHours();
            showBlockByTime(hour);
        };
        
        //ПОказываем блоки по времени
        function showBlockByTime(tm){
            if (tm >= 7 && tm < 12) {
                if (!timeBlocks[0].classList.contains('show-time')) {
                     hideBlock();
                     showBlock(timeBlocks[0])
                };
            };
            if (tm >= 12 && tm < 19) {
                if (!timeBlocks[1].classList.contains('show-time')) {
                     hideBlock();
                     showBlock(timeBlocks[1])
                };
            };
            if (tm >= 19 && tm < 24) {
                if (!timeBlocks[2].classList.contains('show-time')) {
                     hideBlock();
                     showBlock(timeBlocks[2])
                };
            };
            if (tm >= 0 && tm < 7) {
                if (!timeBlocks[3].classList.contains('show-time')) {
                     hideBlock();
                     showBlock(timeBlocks[3])
                };
            };
    
        };
        
        function hideBlock(){
            for (let timeBlock of timeBlocks) {
                 timeBlock.classList.remove('show-time');
            };  
        };
        
        function showBlock(em){
            em.classList.add('show-time');
        };
        
        checkTime();
        
        setInterval(function() {
    	    checkTime();
        }, 10000)
    
    };
    })();    
});    
</script>

<style>

div[class*="uc-time-block"]{
    opacity: 0;
    pointer-events: none;
    z-index: -50;
    position: fixed;
}

div[class*="uc-time-block"].show-time{
    opacity: 1;
    pointer-events: all;
    position: static;
}
</style>
Made on
Tilda