<a id="sistersFriends">@@.castTitle;~ your sister's friends ~@@</a>
You kind of did this backwards. I think you wanted something like:
<a href="#sistersFriends">Link</a>
@@.castTitle;#sistersFriends;~ your sister's friends ~@@
The above creates a link that will bring the #sistersFriends element into view.
So, I went ahead and changed it to this:
<span id="sistersFriends">@@.castTitle;~ your sister's friends ~@@</span>
So, now I just need to find out how to jump to it. :P Any ideas?
Using the span will also work, but this is completely redundant:
THIS CODE:
<span id="sistersFriends">@@.castTitle;~ your sister's friends ~@@</span>
IS PARSED INTO:
<span id="sistersFriends"><span class='castTitle'>~ your sister's friends ~</span></span>
THIS CODE:
@@.castTitle;#sistersFriends;~ your sister's friends ~@@
IS PARSED INTO:
<span id="sistersFriends" class='castTitle'>~ your sister's friends ~</span>
You can use either the custom style markup (i.e. @@ ... @@) or the equivalent HTML, but generally you'll want stick to one or the other. And you will want to avoid making more elements than you need. Your code is generating two elements instead of one, and while it may not seem like a huge deal, it is wasteful.
Anyway, this solution is a bit rough; it'll show up as an external link and it will snap the window to the correct place instantly. Here's a slightly more professional-looking approach:
In story JavaScript:
setup.scrollToID = function (id, time) {
if (!id || typeof id !== 'string' || id[0] !== '#') {
console.error('scrollToID() -> ' + id + ' is not a valid selector.');
return;
}
time = Number(time);
if (Number.isNaN(time) || time < 0) {
time = 500;
}
$('html, body').animate({
scrollTop: $(id).offset().top
}, time);
};
Then, in a widget-tagged passage:
<<widget 'linkToSel'>>\
<<link $args[0]>>
<<run setup.scrollToID($args[1], $args[2])>>
<</link>>\
<</widget>>
And finally, to use it:
<<linkToSel 'link text' '#selector' time>>
* 'link text' - the text of the link
* '#selector' - a selector, must be an ID
* time - optional, must be in milliseconds, determines length of animation, default 500ms
/% using your example %/
<<linkToSel 'Click here.' '#sistersFriends'>>
[...]
@@.castTitle;#sistersFriends;~ your sister's friends ~@@
Clicking a link generated by this widget should scroll the part of the page you want into view smoothly.
Edit.
See below.