Login Register






Change the CSS depending on the hour filter_list
Author
Message
Change the CSS depending on the hour #1
Hello folks, I found this script on a Spanish blog today so I decided to translate it for you. Pretty much what it does is to change the CSS if it's day or night, but you are able to change it because it's really simple.

All you have to do is to copy the script within the head tags.

Code:
<script type="application/javascript"> changeDay = new Date(); hour = changeDay.getHours(); minutes = changeDay.getMinutes(); time = hour + "." + minutes; if (time >= 19.0 && hour < 23.59 || hour >= 0.0 && hour < 5.59) { document.write("<link rel='stylesheet' type='text/css' href='night.css' />"); } else if (hour > 6.0 && hour < 18.00) { document.write("<link rel='stylesheet' type='text/css' href='day.css' />"); } else { document.write("<link rel='stylesheet' type='text/css' href='day.css' />"); } </script>

Reply

RE: Change the CSS depending on the hour #2
This should be useful for some people, thanks for sharing. Smile

Reply

RE: Change the CSS depending on the hour #3
Oxyrus, why would You use this :3?

Reply

RE: Change the CSS depending on the hour #4
(08-13-2015, 09:27 PM)Kill Wrote: Oxyrus, why would You use this :3?

To change your design from light to dark in day and night, or whatever, idk.

Reply

RE: Change the CSS depending on the hour #5
MyBB skin. At morning itll be lighted
at night itll be dark theme Biggrin Tongue

Reply

RE: Change the CSS depending on the hour #6
(08-13-2015, 10:07 PM)Believer Wrote: MyBB skin. At morning itll be lighted
at night itll be dark theme Biggrin Tongue

Honestly I don't think that would look that good, but it's a good idea if you add a 'Nah I want night mode forever!' or 'I want day mode forever :noh: '

Reply

RE: Change the CSS depending on the hour #7
(08-13-2015, 07:21 PM)Pull Wrote: -
Honestly I don't think that would look that good, but it's a good idea if you add a 'Nah I want night mode forever!' or 'I want day mode forever :noh: '

That's easier :3

Reply

RE: Change the CSS depending on the hour #8
(08-13-2015, 10:47 PM)Kill Wrote:
(08-13-2015, 07:21 PM)Pull Wrote: -
Honestly I don't think that would look that good, but it's a good idea if you add a 'Nah I want night mode forever!' or 'I want day mode forever  :noh: '

That's easier :3

Why when you quoted me you made my name say "Pull" ? :angry:

Reply

RE: Change the CSS depending on the hour #9
(08-13-2015, 10:50 PM)0031 Wrote: Why when you quoted me you made my name say "Pull" ?  :angry:

Deleted wrong quotes,  :tongue:

Reply

RE: Change the CSS depending on the hour #10
(08-14-2015, 11:49 AM)Kill Wrote:
(08-13-2015, 10:50 PM)0031 Wrote: Why when you quoted me you made my name say "Pull" ?  :angry:

Deleted wrong quotes,  :tongue:

Oh, lol :noh:

Reply