top of page
Advent Calendar for Christmas

Advent Calendar for Christmas

Increment an Advent calendar through the month of December

Intermediate.png

Intermediate

3K

Published:

December 13, 2020

Anchor 1
Hire a Developer

Example Description

In this example we display an Advent calendar in a repeater. On each day of December until Christmas, we display a new gift site visitors will receive. Visitors can click the repeater item for the current day in the calendar, and the gift for that day is displayed with an animation. Gifts sent on previous days continue to be displayed.

Example Code

Tab 1

.

Tab 2

.

Tab 3

.

This code solution can be complicated.

How We Built It

Database Collection

 

  • AdventGift: Stores gift information to be displayed in the repeater: name, image, date gift is given, and the day (1-24) in the calendar.

 

 

Page Elements

 

  • Repeater: For displaying the calendar.

  • Dataset: For connecting the repeater item elements with the AdventGift database collection content.

 

 

Code

 

The site’s code does the following:

 

  1. For each item in the repeater, compare the current date with the date in the repeater item.

  2. For all repeater items where the current date is greater than the repeater item date, display the gift.

  3. For the repeater item that matches today’s date, show the calendar day in red instead of black. Visitors can click this number to see today’s gift.

  4. For repeater items where the current date is less than the repeater date, hide the gift and show the calendar day.

  5. When site visitors click today’s day, show the new gift with an animation.

 

Note: The current date is set to December 08, 2020 in order to demonstrate the example. To customize the example:

  • Update the dates stored in the Day field in the AdventGift database collection to the span of time you want to run the calendar.

  • On the first day of the calendar, comment out the code on Line 15 and uncomment the code on Line 16 so that the current date is set to today's date.

APIs We Used

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!

Change Site Content

Change Site Content

Change site content in response to a user interaction.

Intermediate.png

Beginner

Hide and Show an Image

Hide and Show an Image

Show and hide an image according to the clicked button.

Intermediate.png

Beginner

Image and Text Animation

Image and Text Animation

Use wix-animations API to animate images and text.

Intermediate.png

Intermediate

Anchor 2
bottom of page