We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Skin Changes with Time of Day
Topic Started: Jun 28 2011, 02:40 PM (266 Views)
MasterHiku
Member Avatar
Member
[ *  * ]
Board Address: Private
Board Software: ZetaBoards
Description: I would like a code that will change the skin with the time of day it is. For instance in my situation, if the time is between 7am - 6pm it will display the DayTime skin. If it's 6:01pm -6:59am then it will display the nighttime skin. Thanks for the help! :)
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
This is fairly simple if you want to change the CSS only, if you want to change the Theme Layout contents as well, it will require something more complex.
Offline Profile Goto Top
 
MasterHiku
Member Avatar
Member
[ *  * ]
Yes, just the CSS; buttons and everything else would simply stay the same.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
var date = new Date();
var time = date.getHours();

if (time <= 7) {
$('link[rel="stylesheet"]').attr('href', 'Night Time CSS Link');
}

if (time >= 8) {
$('link[rel="stylesheet"]').attr('href', 'Daytime CSS Link');
}
</script>
Hopefully that will work, this is my first time trying out date objects.
Offline Profile Goto Top
 
MasterHiku
Member Avatar
Member
[ *  * ]
I couldn't get it to work, not sure if I did it correct I put the links to the CSS's Where it said "Night Time CSS Link" and "Daytime CSS Link"
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Please post the code you tried to use.
Offline Profile Goto Top
 
MasterHiku
Member Avatar
Member
[ *  * ]
Code:
 

<script type="text/javascript">
var date = new Date();
var time = date.getHours();

if (time <= 7) {
$('link[rel="stylesheet"]').attr('href', 'http://s4.zetaboards.com/c/36687/67/css.css');
}

if (time >= 8) {
$('link[rel="stylesheet"]').attr('href', 'http://s4.zetaboards.com/c/37224/3/css.css);
}
</script>
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code:
 
<script type="text/javascript">
var date = new Date();
var time = date.getHours();

if (time <= 7) {
$('link[rel="stylesheet"]').attr('href', 'http://s4.zetaboards.com/c/36687/67/css.css');
}

if (time >= 8) {
$('link[rel="stylesheet"]').attr('href', 'http://s4.zetaboards.com/c/37224/3/css.css');
}
</script>
Try that instead.
Offline Profile Goto Top
 
MasterHiku
Member Avatar
Member
[ *  * ]
It worked! Thanks a bunch! :)
Offline Profile Goto Top
 
ElementalAlchemist-ZNR
Member Avatar
Member
[ *  *  *  *  * ]
Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic