How can I create a looping gif on my home page in Webflow that, when clicked, hides the gif and shows an embedded video that plays immediately?
Published on
September 22, 2023
To create a looping GIF on your home page in Webflow that, when clicked, hides the GIF and shows an embedded video that plays immediately, you can follow these steps:
- Prepare your GIF:
- Create or find a GIF image that you want to use. Ensure that it is saved in a format supported by web browsers (e.g., GIF, PNG, or JPEG).
- Upload the GIF to Webflow:
- Open your Webflow project and go to the Designer.
- Select the page where you want to add the GIF.
- Drag and drop an Image element onto the desired section or container on your page.
- Upload and select the GIF image you want to use.
- Add interaction to hide the GIF and show the video:
- With the Image element selected, click on the Interaction tab in the right sidebar.
- Click on the "+" icon to create a new interaction.
- Choose the trigger type that suits your design (e.g., click, hover, or scroll). For this example, select Click.
- Under "Element Triggered," select the Image element.
- In the "Affect" dropdown, select "Hide."
- Click on the "Add action" button and choose "Display" from the dropdown menu.
- Select the video element where you want to embed your video.
- In the "Initial appearance" dropdown, select "None" to hide the video initially.
- Add the video to Webflow:
- Drag and drop a Video element onto your page, preferably in the same section or container where the GIF is located.
- Set the source of the embedded video by clicking on the Video element. In the right sidebar, paste the video link under "Video Source."
- Configure the video to play immediately:
- With the Video element selected, go to the Styles tab in the right sidebar.
- Under "Initial states," click on the "+" icon to create a new initial state.
- Configure the initial state to have a display property of "Initial" and an opacity of 100%.
- Click on the "+" icon again to create a new animation.
- In the animation timeline, click on the "+" icon to add a new keyframe.
- Move the playhead to 0% and set the opacity to 0%.
- Move the playhead to 100% and set the opacity to 100%.
- Preview and publish:
- Preview your website to test the interaction between the GIF and the embedded video.
- Once you're satisfied, publish your changes to make them live on your website.
By following these steps, you should be able to create a looping GIF on your home page in Webflow that, when clicked, hides the GIF and shows an embedded video that plays immediately.
Additional Questions:
- How do I upload an image in Webflow?
- How can I add an interaction in Webflow?
- How do I embed a video in Webflow?