Twine with sugarcube: can you display visited links differently?

0 votes
222 views
asked Apr 14 in Authoring by peterorme (104 points)

In Twine (1.4) using the Sugarcube story format, is there some way to display links to visited passages so they look different from unvisited links? They are "a" html anchors, but using a an a:visited css selector does not cut it, I assume because the linking is done using javascript "click" events, not standard browser linking.

1 Answer

+2 votes
answered Apr 15 by peterorme (104 points)
 
Best answer

Allegedly a:visited doesn't work in any story format.

If you are using SugarCube you can use a trick.

Step 1. Enable visited link tracking with config.addVisitedLinkClass. Just create a script passage with the line

    config.addVisitedLinkClass = true;

This will start appending the link-visited CSS class to visited links.

Step 2. Add a stylesheet passage setting

    a.link-visited {
       color: purple;
    } 

Kudos to TheMadExile who answered this question on Twinery.org forums.

This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...