Using tm-scroll to scroll to a section of a long tiddler (5.1.23)

49 views
Skip to first unread message

Hubert

unread,
Jan 20, 2021, 6:39:55 AM1/20/21
to TiddlyWiki
Hi,

Since 5.1.23, we've had the ability to scroll onto a section within a long tiddler using the extended tm-scroll widget message by specifying the scroll target as a CSS class of the target element.

I've tried this both within the <$scrollable/> widget and without using it but couldn't get it to work in either case. I keep getting the red JS error message ("element undefined").

Here's my code:

<$button actions="""<$action-sendmessage $message="tm-scroll" $selector=".bottom"/>""">
Scroll
</$button>


Then there's several paragraphs of the lorem ipsum text with the bottom part wrapped in a div with the class "bottom", i.e.:

{{Lorem Ipsum}}
<div class="bottom">
{{Lorem Ipsum}}
</div>

When clicking the above button to scroll, I always get the same JS error message. What have I missed?

Thanks for your help.
Hubert

js_error.png

Saq Imtiaz

unread,
Jan 20, 2021, 7:50:59 AM1/20/21
to TiddlyWiki
try selector=".bottom" and not $selector.

Hubert

unread,
Jan 20, 2021, 8:15:56 AM1/20/21
to TiddlyWiki
Again, thank you!

This now works, albeit only on "vanilla" tiddlers, not on tiddlers affected by my view templates. I'll need to investigate further to see if it's my CSS that could be affecting the scrolling (margins, transforms etc.) or if it's the view template "mechanism" itself that could be invalidating the scrolling mechanism (well, I hope it's not the latter).

Regards,
Hubert
Reply all
Reply to author
Forward
0 new messages