How to stop and restart #each loop

Hi I have a gallery site which displays paintings according to selected category (oils, water-color, etc.) “on:click” event.
When this event occurs I create a new filter and want to stop the #each loop and restart it using the new filter, what is the best way to do this?
Thanks for any help

Corresponding tweet for this thread:

Share link for this tweet.

Post the code you are using David - be easier to see what you mean then :023:

Hi Aston,
I’ve managed to patch most of this together, here’s the repl:

Only thing not working in repl is

{document.body.scrollTo( 0, 0 )} I’ve run “npm install --save-dev
svelte-scrollto” but don’t know how to trigger it without on:click

To position at top of page when Oil on canvas or Acrylic is clicked -
running in localhost works ok.

Like to hear any suggestions on how this code can be improved - this
is my 1st svelte app.

Thanks for any help