Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

only applies to passage

Hi. I'm very new to Twine so I imagine this is an easy fix. I want to have the background color in my game change based on the time of day, (which is mapped to a variable). When the time of day changes, I use <<addclass "body" "class">> and it works, but the second I move onto a new passage the background goes back to its default color so it looks like the class isn't saved. Is there a way to keep class additions through passage changes. I am using sugarcube by the way.

Comments

  • You also need to state the full version (eg v1.0.35) of the story format you are using, as answers can be different for each one.

    The Passage Tag based CSS Styling feature of SugarCube (v1.x and v2.x) assigns CSS classes to the body element, this feature is removing the custom CSS classes you are adding to the same element when the story moves from one passage to another.

    As you want to dynamically add your custom CSS classes I suggest moving them to the html element.
  • I'm using 1.0.32. Would I just say <<addclass "html" "class">>
  • IanGRap wrote: »
    Would I just say <<addclass "html" "class">>
    Yes.
Sign In or Register to comment.