Decorating your website with seasonal embellishments is an excellent method to captivate users’ attention. Especially on special occasions like the holiday season, adding small touches to your site can enhance the visitor experience. Today, I will guide you step-by-step on how to add an impressive snow effect to your Flatsome website using a plugin called Code Snippets.
Step 1: Install the Necessary Plugin
The first thing you need to do to add a snow effect is to install a plugin called Code Snippets. This plugin allows you to add pieces of code, such as HTML, CSS, and Javascript, to your website. It also offers a toggle feature that lets you manage these codes and activate or deactivate them whenever you want. This feature helps you quickly enable certain codes to enhance your customer’s experience.
Step 2: Add the Snow Effect Code
After installing the plugin, copy the HTML code provided below and create a new snippet in Code Snippets. When creating this snippet, remember to paste your code in the HTML section.
This freely available code is locked down.
Log in or create an account to access our magic code.
Go to the settings of the snippet you created and select where the code will run. In this case, check the option “Display at the end of the <body> section, in the footer.”
After completing all settings, activate the snippet you created. This way, visitors will immediately see the snow effect when they enter your site.
Result:
BONUS: Customizing the Speed and Size of Snowfall
If you want to further personalize the snow effect added to your website, you can offer your visitors a unique experience by adjusting the speed and size of the snowflakes. These customizations can make it more harmonious with your site’s visual theme and leave a more impactful impression on visitors.
Controlling the Size of the Snowflakes
The size of each snowflake is set in the resetSnowflake function. You can control the size by modifying the range of the Math.random() function. The size is currently determined by Math.random() * 5 + 1, which means the size can vary between 1px and 6px. Adjusting these values will change the minimum and maximum size of the snowflakes.
const size = Math.random() * 5 + 1; // Change 5 to increase/decrease the range
Controlling the Snowfall Speed
The snowfall speed in your code is influenced by the fallSpeed variable. This variable acts as a divisor to the randomly generated duration for which a snowflake falls. Increasing the value of fallSpeed will decrease the animationDuration, making the snowflakes fall faster. Conversely, decreasing fallSpeed will make them fall slower.
const fallSpeed = 1.25; // Increase to make snowflakes fall faster
With these simple steps, you can add a festive touch to your Flatsome-themed website for the holiday season. Remember, such seasonal changes enrich the user experience and can increase visitors’ interest in your site. Happy New Year and wish you snowy days!