Howdy, Stranger!

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

[sugarcube] display visited links differently?

Hi.

Unless I'm mistaken, regular a:visited css doesn't work for sugarcube. (Twine 1.4, only tried it in Chrome on OS X).

Is there some other way of displaying links that the player has already clicked (or, even better, links leading to visited passages) visually different from unvisited links?

Or, more generally - is there a simple way to apply a css class to a link when you put a link in a passage?

Comments

  • I can apply css to different links in SugarCube in Twine 2 (which should be same as 1.4).

    <<if $altlink is 1>><span class="altlink">[[click here]]</span><</if>>
    Then you can set $altlink to 1 on any passage you want.

    Make sure your span is outside the brackets.

  • peterorme wrote:
    Unless I'm mistaken, regular a:visited css doesn't work for sugarcube. (Twine 1.4, only tried it in Chrome on OS X).


    Correct.  The :visited pseudo-class doesn't work properly in any story format because of how they function.

    You can, however, get the effect you want from the .link-visited class, which you enable via the config.addVisitedLinkClass configuration property.

    Add the following to a script tagged passage:
    config.addVisitedLinkClass = true;
    Afterward you should be able to use something like the following to style visited links:

    a.link-visited {
    color: purple;
    }
Sign In or Register to comment.