0 votes
by (170 points)
the following is the code for a sidebar I made

tw-passage tw-include[title="Sidebar handler"] {
    width: 6em;
    position: absolute;
    left: -7em;
    top: 0;
    padding: 0.5em;
    text-overflow: scroll;
      border: 0.5em, solid, purple;
}

inside the sidebar handler, this is the code

(link:"Inventory")[(goto:"Inventory")]

 

and in inventory,

 

(link-goto:"Return",(history:)'s last)

 

this obviously creates an issue because someone can accidentally click on inventory twice and not be able to leave, as the last in history will be inventory

 

how would i hide this sidebar once an option like inventory is clicked, or is there a better way to accomplish a sidebar

1 Answer

0 votes
by (159k points)
selected by
 
Best answer

First an answer to a question you didn't ask, how to implement a automatic "return from a menu related passage" system.

This article within the Old Forum Archive describes how to use a Story Variable combinded with a known Passage Tag do this, which should remove your need to hide the 'side-bad' in the first place. (1)

Now to answer your actual question...

You can use a known Passage Tag (like the same menu tag used in the article) to mark each of your menu like passages (eg. the Inventory passage), and then use CSS styling that targets that passage tag within your project's Story Stylesheet area to hide the 'side-bar'.

eg. Assuming you have assign the Inventory passage a menu passage tag then the following CSS will hide the 'side-bar' when that passage is shown.

tw-story[tags="menu"] tw-sidebar {
	display: none;
}


(1) The code in the linked article was written for the Harlowe 1.x series but it will also work as is within both the 2.x and 3.x series, however both those later series include the (unless:) macro which can be used to make the code placed within the header tagged special passage a little easier to read.

Replace the (if:) macro used in the header tagged passage with the following if you are using either 2.x or 3.x series of Harlowe.

(unless: (passage:)'s tags contains "menu")[(set: $lastPassage to (passage:)'s name)]

 

by (100 points)

 

Select a text or text box, then in the "Format" mail-order-bride sidebar, do one of the following:

...