Hello everyone I m having this requirement…
1 . I have two pages now in my wix site. in page 1 there is button called red and another button called green. if i click button red, one container box which is in page 2(default color green) should get converted into red color and remain as such . It should get converted into green only if i click button green.
- One small thing , if i convert this container box to red from green and then if I re login to my site it should still remain into red only. it should be green only after click of button green.
Basically i want to control my container box which is present in page 2 from my home page(page 1).
Please suggest if there is any way for this.
Thanks.
Hi Pushkin!
You have few solutions for this blocker depending on your needs:
Local storage:
You can use the user’s local storage and set the value of the box at the first time of choice.
Use the wix-Storage API to save a value in the local storage (like cookies/cache).
Note that if the user will clear his local storage, the setting would be lost.
Query params:
You can use query params in order to navigate to the next page by the wanted value of color depending on the box clicked. Follow this API in order to use the Query params and simply add to the query the color according to the box that was clicked.
Boolean field:
You can simply add in your database a boolean field that will be true/false according to the color selected (for example - if the user chose green - turn the field to ‘true’). On the next page, in the onReady function, simply check the value of the field and adjust the color of the box accordingly.
Hope it helps!
Doron. 