0 votes
by (590 points)
So the text contained by linkreplace is on the upper side of the screen after cliking on it. I don't mean changing passage with goto.

2 Answers

0 votes
by (960 points)
selected by
Best answer
The <<replacelink>> addon does exactly what you're looking for. It's available at the bottom of this page: http://www.motoslave.net/sugarcube/2/

Just copy and paste the javascript and css code into the respective editor in Twine and replace your <<linkreplace>> macro with <<replacelink>>.
0 votes
by (38.6k points)
edited by

First, you'll need to grab the code for the <<ScrollTo>> macro here and add it to your JavaScript section.

Next, instead of using the <<linkreplace>> macro, you'll have to use some code like this:

	<span id="uniqueName">
		<<link "Original link text.">>
			<<ScrollTo "uniqueName">>
			<<replace "#uniqueName">>
				Replacement text.

Or, if you don't mind having it as one long line of code, something like this:

<span id="uniqueName"><<link "Original link text.">><<ScrollTo "uniqueName">><<replace "#uniqueName">>Replacement text.<</replace>><</link>></span>

Just make sure that the <span>'s ID attribute is unique for each of these in any particular passage.

If you need to do that a lot, then you could turn that code into a macro.

Enjoy!  :-)

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.