Video Background with Javascript

-3

I have been doing a background through JS that changes according to the time of day, and I have a doubt.
The background It works like this:
- I have a video that runs from 7 am (example: 07:00:00) and when the night comes (19:10:12) I need to change the video background.
- The clock works, but it does not change the video when the set time arrives.

You can check the code here. link

    
asked by Jair B. 04.10.2018 в 22:36
source

1 answer

0

I think it does not evaluate well if. Keep in mind that evaluate the time as a chain. Get the time in milliseconds and compare it with the time you want also in milliseconds.

I leave you a revision of your code that works partially. Evaluate the two dates, but do not make the change unless the page is reloaded.

link

    
answered by 05.10.2018 в 01:01