Ok, so I created 2 scripts and I tested that both work. Setting the var setHoliday = [value];
to any one of the appropriate holiday numbers does add the appropriate class to the body element. These 2 scripts require jQuery to run so the site you want them on needs to use jQuery. If it doesn't then a vanilla JS script needs to be written instead.
You can use "either one" that you are more comfortable with using. I made an assumption of the classes names so change those accordingly to what you want. The second script in theory is supposed to execute slightly quicker then script 1.
The only real gotcha on doing it this way using JS is that if there is a delay in the execution of the script, you might see the site actually switch styles. :)
In the app just right click on Javascript in the Design pane and select "Create JS". Then double click on the untitled.js and copy/paste one of the 2 scripts and then click the APPLY button above.
Script #1 My original switch case
$(function(){
// New Year's Day = 1, Valentine's Day = 2, St. Patrick's Day = 3, Mardi Gras = 4
// Easter = 5, Mother's Day = 6, Memorial Day = 7, Father's Day = 8
// Labor Day = 9, Sweetest Day = 10, Halloween = 11, Veteran's Day = 12
// Thanksgiving Day = 13, Christmas = 14
// no holiday = 0;
var setHoliday = 0;
switch (setHoliday){
case 0:
break;
case 1:
$("body").addClass("new_years_day");
break;
case 2:
$("body").addClass("valentines_day");
break;
case 3:
$("body").addClass("st_patricks_day");
break;
case 4:
$("body").addClass("mardi_gras");
break;
case 5:
$("body").addClass("easter");
break;
case 6:
$("body").addClass("mothers_day");
break;
case 7:
$("body").addClass("memorial_day");
break;
case 8:
$("body").addClass("fathers_day");
break;
case 9:
$("body").addClass("labor_day");
break;
case 10:
$("body").addClass("sweetest_day");
break;
case 11:
$("body").addClass("halloween");
break;
case 12:
$("body").addClass("veterans_day");
break;
case 13:
$("body").addClass("thanksgiving_day");
break;
case 14:
$("body").addClass("christmas");
}
});
Script 2 the more traditional if/else if testing
$(function(){
// New Year's Day = 1, Valentine's Day = 2, St. Patrick's Day = 3, Mardi Gras = 4
// Easter = 5, Mother's Day = 6, Memorial Day = 7, Father's Day = 8
// Labor Day = 9, Sweetest Day = 10, Halloween = 11, Veteran's Day = 12
// Thanksgiving Day = 13, Christmas = 14
// no holiday = 0;
var setHoliday = 0;
if (setHoliday == 0){
}else if (setHoliday == 1){
$("body").addClass("new_years_day");
}else if (setHoliday == 2){
$("body").addClass("valentines_day");
}else if (setHoliday == 3){
$("body").addClass("st_patricks_day");
}else if (setHoliday == 4){
$("body").addClass("mardi_gras");
}else if (setHoliday == 5){
$("body").addClass("easter");
}else if (setHoliday == 6){
$("body").addClass("mothers_day");
}else if (setHoliday == 7){
$("body").addClass("memorial_day");
}else if (setHoliday == 8){
$("body").addClass("fathers_day");
}else if (setHoliday == 9){
$("body").addClass("labor_day");
}else if (setHoliday == 10){
$("body").addClass("sweetest_day");
}else if (setHoliday == 11){
$("body").addClass("halloween");
}else if (setHoliday == 12){
$("body").addClass("veterans_day");
}else if (setHoliday == 13){
$("body").addClass("thanksgiving_day");
}else if (setHoliday == 14){
$("body").addClass("christmas");
}
});
Saj