Twine Version: 2.10.0
I have dropped the script shown below into the javascript section of a new, blank desktop Twine 2.10.0 story. The font size change works, but the font face doesn’t change when I alter it in Settings. I think maybe I’m targeting the wrong element (I know next to nothing about CSS and only a little about html):
Below is the script:
Config.passages.nobr = true;
Config.saves.slots = 3;
var settingFontFamily = ["Serif", "Sans Serif", "Monospace"];
var fontFamily = function() {
var $html = $("html");
$html.removeClass("serif sansserif monospace");
switch (settings.fontFamily) {
case "Serif":
$html.addClass("serif");
break;
case "Sans Serif":
$html.addClass("sansserif");
break;
case "Monospace":
$html.addClass("monospace");
break;
}};
Setting.addList("fontFamily", {
label : "Change font type",
list : settingFontFamily,
default : "Monospace",
onInit : fontFamily,
onChange : fontFamily
});
var settingFontSize = ["75%", "100%", "125%", "150%"];
var resizeFont = function() {
var size = document.getElementById("passages");
switch (settings.fontSize) {
case "100%":
size.style.fontSize = "100%";
break;
case "75%":
size.style.fontSize = "75%";
break;
case "125%":
size.style.fontSize = "125%";
break;
case "150%":
size.style.fontSize = "150%";
break;
}
};
Setting.addList("fontSize", {
label : "Change Font Size",
list : settingFontSize,
default : "100%",
onInit : resizeFont,
onChange : resizeFont
});