#1
1 messages · Page 1 of 1 (latest)
Hello there! 👋
You're looking to create a paginated system where clicking a button hides some elements and shows others. You can achieve this using FancyMenu's variable system and loading requirements.
Here's a concise guide on how to set it up:
-
Create a Variable:
- Go to Customization -> Variables -> Manage Variables from the menu bar.
- Add a new variable (e.g.,
currentPage) and set its initial value (e.g.,1).
-
Configure Your Elements (Images/Text):
- For Page 1 Elements: Right-click the element in the editor, go to Loading Requirements, and add an "Is Variable Value" requirement. Set it to check if your
currentPagevariable equals1. - For Page 2 Elements: Repeat the above steps, but set the requirement to check if
currentPageequals2. - Continue this for all your pages.
- For Page 1 Elements: Right-click the element in the editor, go to Loading Requirements, and add an "Is Variable Value" requirement. Set it to check if your
-
Set Up Navigation Buttons:
- "Next Page" Button:
- Right-click the button and select Edit Action Script.
- Add an IF Statement to check if
currentPageis the last page (e.g.,if currentPage == 2). If it is, setcurrentPageback to1. - ELSE, add an action to increment the
currentPagevariable (e.g.,currentPage:{"placeholder":"calc","values":{"expression":"{"placeholder":"getvariable","values":{"name":"currentPage"}} + 1"}}).
- "Previous Page" Button:
- Similar to the "Next Page" button, but decrement
currentPageand handle the case ifcurrentPageis1.
- Similar to the "Next Page" button, but decrement
- "Next Page" Button:
This way, when a button is clicked, the currentPage variable updates, and FancyMenu automatically hides/shows elements based on their loading requirements.
You can find more detailed information on setting this up in the documentation:
- Variables
- Conditions (Loading Requirements)
- Toggle Parts of Layouts (which includes cycling through values)
Let me know if you have any more questions! 😊
I have made the visibility requirements for the page=2 elements, how do I make the variable change its value when I click the button