0
0
0leg5ergeev2015-10-04 18:31:06
css
0leg5ergeev, 2015-10-04 18:31:06

How to load different css relative to time of day?

Wrote something like this. Changes the styles of objects over time.

<script>var d = new Date();
      var time = d.getHours();
      if ( time  > 18) {
        document.getElementById('section1').style.backgroundImage = "url('img/bg2.jpg')";
        document.getElementById('utm_title').style.color = "#fff";
        document.getElementById('utm_desc').style.color = "#fff";
      }
    </script>

but it turned out that we would have to change a lot of objects, so there is an idea to load a whole css file. how to implement this? :with

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Vasiliev, 2015-10-04
@0leg5ergeev

codepen.io/corvus-007/pen/EVWGxx?editors=101

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question