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 (44.7k 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:

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

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!  :-)

...