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

What is Framer? Join the Community
Return to index
Sune Matras
Posted Oct 01 - Read on Facebook

Hi !
I'm trying to fake a dynamic back button that "remembers the browser history", I'm trying to use an if/else statement on the button.

There's only 3 screens (home, list, and detail):

- When user goes to the detail screen by selecting the shortcut on the home screen, the back button should take user back to home screen.

- When user goes to the detail screen by selecting 'View list' on the home screen and then tapping the first item on the list screen, the back button should take user back to the list screen.

I'm using a state on the home screen (home_on) to set the if/else condition.
My if/else statement looks like this but it's not working :(

[BUTTON TAP START]
BTN_back.onTapStart ->
BTN_back.states.switch("down")

[BUTTON TAP END — IF/ELSE]
BTN_back.onTapEnd ->
if list.states = "home_on"

[GO TO HOME]
detail.states.switch("detail_off")
home.states.switch("home_on")
BTN_back.states.switch("default")

[GO TO LIST]
else
detail.states.switch("detail_off")
home.states.switch("home_off")
list.states.switch("list_on")
BTN_back.states.switch("default")

The error I'm getting is "Unexpected if".

In this example it only goes to home screen —> http://share.framerjs.com/cg3z4npjkpsf/

How is it possible to create this "browser history" on the back button?

2 Comments

Jonas Treub

When you open a certain screen I made sure if is shown on top of the current screen, without removing the previous screen. That way you have a history without having to do any management. Here you go: http://share.framerjs.com/0rp9s4e7roz1/

Sune Matras

Jonas Treub such a simple solve - duh! Thanks, much appreciated :)

Read the entire post on Facebook