Hi Hubert

I’m afraid the dynaview plugin examples were out of date which made things 
difficult. It’s fixed now, and you can try it out on the prerelease:

https://tiddlywiki.com/prerelease/#%24%3A%2Fplugins%2Ftiddlywiki%2Fdynaview 
<https://tiddlywiki.com/prerelease/#$:/plugins/tiddlywiki/dynaview>

Here’s a minimal example of making a DIV invisible until it is scrolled into 
view:

<div class="tc-dynaview-track-tiddler-when-visible" 
data-dynaview-track-tiddler="$:/state/lorem-visibility">
<$reveal state="$:/state/lorem-visibility" type="nomatch" text="0" tag="div">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor 
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis 
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu 
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in 
culpa qui officia deserunt mollit anim id est laborum.
</$reveal>
</div>

The dynaview plugin checks the DOM at frequent intervals for DOM nodes with the 
class tc-dynaview-track-tiddler-when-visible and the attribute 
data-dynaview-track-tiddler. For any that it finds, it updates the specified 
tiddler with the visibility state of the DIV (blank = not scrolled into view, 0 
= scrolled into view but subsequently scrolled out again, 1 = nearly in view 
and 2 = fully or partially in view).

As usual with TiddlyWiki, the current visibility state is kept in a tiddler. If 
you have many DIVs to handle then you’ll need to adopt an approach for 
generating unique state tiddler titles.

Best wishes

Jeremy.


> On 13 May 2020, at 13:11, Hubert <hubert...@gmail.com> wrote:
> 
> Hello,
> 
> I know that we have the Dynalist plugin but from what I've gathered it's 
> currently at the proof of concept stage of development. From studying its 
> documentation and code I can also see that it's very ambitious and that it 
> may take some time/effort to make it truly "deployable".
> 
> What I'm looking for is a fairly simple functionality whereby an element (a 
> div or even a portion of text within a tiddler, definitely not the entire 
> tiddler) could be hidden and only appear when scrolled into view (through JS 
> and CSS display:none > display:initial or something else).
> 
> Could this be accomplished by wrapping the content in a widget, either a new 
> standalone widget or perhaps an upgraded $reveal widget, that would detect 
> the vertical scroll position/viewport etc. and only reveal content when it's 
> visible?
> 
> I've already had a look at a similar solution here 
> <https://stackoverflow.com/questions/49916259/show-element-when-in-viewport-on-scroll>
>  but could not get it to work as a TW JavaScript widget yet.
> 
> I'm using the poor man's single tiddler view ;) (zoomin) with animation set 
> to 0 and have no interest in the other storyviews, though I understand that 
> there might be an issue getting this solution to work consistently across all 
> the storyviews.
> 
> I was wondering if anyone built something similar and would be willing to 
> share their approach?
> 
> Thank you,
> Hubert
> 
> 
> even through CSS ("display: none") based on it's class
> 
> 
> 
> Show element when in viewport on scroll 
> <https://stackoverflow.com/questions/49916259/show-element-when-in-viewport-on-scroll>
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to tiddlywiki+unsubscr...@googlegroups.com 
> <mailto:tiddlywiki+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/7ae015fc-0679-460b-b3a3-584906aff425%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/7ae015fc-0679-460b-b3a3-584906aff425%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/85D36502-F727-4A42-AAB9-EF06B097CCCE%40gmail.com.

Reply via email to