top of page
Repeater Context

Repeater Context

Change a specific item in a repeater when a site visitor interacts with it

Intermediate.png

Beginner

3K

Published:

January 20, 2021

Girl Enjoying her Drink

by

Anchor 1
Hire a Developer

Example Description

In this example we demonstrate how to get the context of a user interaction with a specific item in a repeater and how to use that context to perform additional actions on the item. When site visitors click the switch of a specific repeater item, we show or hide elements within the same item.

Example Code

Tab 1

.

Tab 2

.

Tab 3

.

This code solution can be complicated.

How We Built It


Page Elements


We added a repeater to our page and attached the following elements to our repeater:

  • Image: is hidden when a site visitor changes the switch to Hide and is shown when switching the switch to Show.

  • Text element: description text which is hidden when a site visitor changes the switch to Hide and is shown when switching the switch to Show.

  • Switch: for hiding and showing the repeater item elements.



Code


If a site visitor clicks a switch in one of the repeater items, do the following:

  1. Define animation options for hiding and showing the image and text elements.

  2. Using the context of the click event, build a selector function for the repeater item in which the switch was clicked.

  3. Using the selector function, check whether the selected switch is checked. If it is, show the image and text element in the same repeater item.

  4. If the switch isn’t checked, hide the image and text element in the same repeater item.

APIs We Used

Non-code example.

Non-code example.

Non-code example.

Non-code example.

Related Articles

Article Link

Hire a Developer

Velo solutions are powerful tools, but building them on your own can be challenging. Let an experienced Velo development shop build it for you, so you can keep working on your site or business.

Related Examples

Did this help?

Yes

|

No

Thanks for your feedback!

Mega Search

Mega Search

Filter a repeater using multiple input components.

Intermediate.png

Advanced

Multiple Filter Methods

Multiple Filter Methods

Apply multiple filters to store products, with or without a dataset

Intermediate.png

Intermediate

Zoom-In Effect

Zoom-In Effect

Add a hover animation to repeater items

Intermediate.png

Beginner

Anchor 2
bottom of page