In this lesson:
- Create an animation to make an element appear
- Create an animation to make an element disappear
- Add a second trigger element to show and configure both to show/hide on click
Create an animation to make an element appear
- Select the element you’d like to act as the trigger (e.g., "Show" button)
- In the Interactions panel, choose Mouse Click (Tap) from the On Selected Element menu
- From On 1st Click select Start an Animation
- Click the plus sign next to Timed Actions
- Name the animation “Show”
- Select the element you’d like to appear (this should be different from the trigger)
- Click the plus sign next to Timed Actions and choose Hide/Show
- Click the eye icon to set the Display to none
- Click the box next to Set as initial state
- While still in the Interactions panel display, click the plus sign to add a second Hide/Show action under Timed Actions
- Under Hide/Show, make the display setting whatever the original value was (Block, in our case)
Create an animation to make an element disappear
- Select the element the same trigger element from the previous step
- From On 2nd Click select Start an Animation
- Click the plus sign next to Timed Actions
- Name the animation “Hide”
- Select the same element from the previous step you’d like to disappear
- Click the plus sign next to Timed Actions and choose Hide/Show
- Click the eye icon to set the Display to none
Add a second trigger element and configure both to show/hide on click
- Click and duplicate original trigger element (“Show Lyrics” text)
- Rename it (e.g., “Hide Lyrics”)
- Create an action and set its initial state display to none
- Add a second action and make the display setting the original value (e.g., Block)
- Click “Show Lyrics” and make sure its display setting is set to none to hide it on click
- Click “Hide Lyrics” and add an animation that sets the display setting to none
- Return to “Show Lyrics,” add an animation to make it visible again on 2nd click
- Click and drag to make everything in timed actions is happening at the same time (0 seconds)
Want to create an accordion to progressively display content, for example, for FAQs? Check out building a custom accordion.