bestguy / sveltestrap

Bootstrap 4 & 5 components for Svelte
https://sveltestrap.js.org
MIT License
1.3k stars 183 forks source link

Access/set Row's div's scrollTop? #409

Closed OJFord closed 2 years ago

OJFord commented 2 years ago

I want to modify the scrollTop on (the div underlying) a Row, in order to set its scroll position back to the top when the contained content changes.

This is the closest I can get:

<script>
export let content;

let ContentRow;
$: if (content.id && ContentRow) ContentRow.scrollTop = 0; // no good
</script>

<Row class="flex-fill mh-100 scroll" bind:this={ContentRow}>
...
</Row>

but that's no good since ContentRow doesn't have a scrollTop (until I create it there) - the one I want is, I think, the <div>'s in Row.svelte. But as far as I can see that's not accessible from binding to Row?

bestguy commented 2 years ago

Hi @OJFord , yes it's a limitation with Svelte, you can'd bind this to custom components.. I could expose the inner div though with a new prop, will take a look