Is there a way to set a class attribute in the .css file with session variables. So I'm setting a class for particular item e.g. custom-background class. But this custom-background gets set eveyday using a different color read from the database. In theory, I want the class to look like:
Then you'd create some JS code that based on the day, you would remove the classes of any day that is not today and then set the class of today's.
On second thought, it might be easier to use a data- attribute modifier to simply change the value rather than clearing and setting classes for something like this.
function checkDay(){
var d = new Date(),
dNames = ["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],
tDay = d.getDay();
$(".custom-background").addClass(dNames[tDay]);
}
$(function(){
checkDay();
});
Doesn't need to clear out any classes because the only added class would be today's class. And because you're changing the class, you can CSS modify anything then. i.e. Font/Size/Style border background-image/color etc..