This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Maximilian Bredow
Posted Nov 12 - Read on Facebook

EDIT: Solved by Kevin. Reusable page indicator dots for foto galleries: https://framer.cloud/fNXKo

How to replicate a set of layers, states and events?

I want to replicate page indicators for later use. Writing the layers, states and events from scratch works fine but my prototype has two more slideshows and I feel my code repeats itself and this could be solved more efficiently.

When trying to write this as a function I failed miserably. What am I doing wrong? Is a function even the correct way to approach this, or is it better to use a class in this case? Thanks!

3 Comments

Kevin Mao

What error are you getting with your function? I just typed your code into Framer and it worked fine, but I created the pageCountOnboarding variable up top.

Kevin Mao

My advice worked 😱 I removed the container and layer inputs, and then moved the change:currentPage function within your indicatePages function so that the container.children can be referenced within scope.
I don't even know if I'm using the correct coding terminology 😂
https://framer.cloud/sSBIM

Maximilian Bredow

You're the man! I updated it a bit and now have two independent sets of indicators. Thanks! https://framer.cloud/fNXKo

Another question: Say I want to access the layers after running the function. How do I do that? Framer tells me "Can't find variable" whenever I want to do anything with it

Read the entire post on Facebook