Folks,
I am working on a scroll to anchor within a tiddler and need to solve the following if possible;
Can I have a single click both open a tiddler and scroll to a position within that tiddler?
In the following code the button uses the actions parameter, it always navigates to the current tiddler including when it is not open. This a code snippet and does not work standalone;
\define scroll-to-actions(string time:"1000")
<$action-navigate $to=<<currentTiddler>> $scroll=no/>
<$action-sendmessage $message="tm-scroll" selector="[anchor='$string$']" animationDuration="$time$"/>
\end
<$button class="tc-btn-invisible tc-tiddlylink" tooltip="Click to scroll to this item" actions=<<scroll-to-actions """$text$""" """$time$""">> >
$text$
</$button>
- If the current tiddler is open already it scrolls to the correct string.
- If the current tiddler is NOT open already, it opens the correct tiddler, but must be clicked a second time to scroll to the correct string.
I have tried the actionNavigate in the button body and the scroll only in the button actions but that did not work any differently.
Is there a way to ensure the one (1) click causes BOTH actions to be performed one after the other?
Modifying the $scroll to yes
- If scroll=yes it and the current tiddler is OPEN or NOT already, it opens the correct tiddler, but clicking will never scroll to the correct string.
Using the message on the button
<$button message="tm-navigate" navigateTo=<<currentTiddler>>
Does not open the tiddler