You need to implement a slider that changes the slides every 45 seconds, so that when entering the site, the user sees not the first slide, but the one that should be displayed depending on the time. Any ideas how to implement this?

    1 answer 1

    Well, if an idea, then:

    var hour = new Date().getHours(); if (hour < 12){ // morning // ... удалить\добавить класс active для определенного слайдера } else if (hour > 16){ // evening // ... удалить\добавить класс active для определенного слайдера } 
    • if there are 15 sliders, then there are too many conditions, no more options - lesha310392
    • every 45 seconds - Alex
    • Alex, and if every 3 seconds, you need to change, only 15 slides - lesha310392
    • @ lesha310392, take the current time and divide it into your periods. - user207618