Login Register






Change the CSS depending on the time filter_list
Author
Message
Change the CSS depending on the time #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 time #2
This is very interesting.

Can make for a good kind of day/night and looks easy enough to implement it for each member based on their time zone
[img=0x150]http://imgur.com/BD5LxZb.png[/img]
I'm done being an autism.  

Reply