This headline is epic!
📜 Scrolling Text Box Effect for Squarespace
Copy and paste this into a Code Block inside your Squarespace site.
🚀 How to Customize the Scrolling Text Box Effect
These instructions will help you tweak the rotating text, colors, fonts, and animation speed to match your Squarespace site.
📝 1. Edit the Static Text
The static text is the part that remains the same. To change it, edit this line inside the <p>
tag:
<p class="static-text">This headline is
<span class="rotating-word">epic!</span>
</p>
For example, if you want it to say "My brand is", update it like this:
<p class="static-text">My brand is
<span class="rotating-word">epic!</span>
</p>
🔄 2. Edit the Rotating Words
The words that rotate are stored inside this JavaScript array:
const words = ["epic!", "tight", "gnarley 🤙", "sweet", "legit", "😎😎"];
To add, remove, or replace words, simply modify this list.
For example, if you want to change the words to "modern", "sleek", "awesome", update it like this:
const words = ["modern", "sleek", "awesome"];
🎨 3. Edit the Colors
Static text color: Edit this in the CSS:
.rotating-text-container {
color: #333; /* Change this to any color */
}
Rotating word background color: Modify this:
.rotating-word {
background: #14A19D; /* Change this to any color */
}
Rotating word text color: Edit this line:
.rotating-word {
color: white; /* Change to any color */
}
🎨 4. Change the Background Color
To modify the background color, update this section in the CSS:
.rotating-text-container {
background: white; /* Change to any color */
}
Example: If you want a light gray background, change it like this:
.rotating-text-container {
background: #f8f9fa;
}
🔠 5. Change the Font (Size, Weight, Style)
This code automatically inherits your Squarespace site fonts—no need to change it manually.
However, if you want custom font styles, adjust these:
Edit the font size:
.static-text {
font-size: 2rem; /* Increase or decrease */
}
Change the font weight (boldness):
.static-text {
font-weight: 300; /* Options: 300 (light), 400 (normal), 700 (bold) */
}
Make the rotating word bolder or lighter:
.rotating-word {
font-weight: 700; /* Adjust as needed */
}
To change the font size on mobile
1. Find this code:
/* Mobile Optimization */
@media (max-width: 768px) {
.rotating-text-container {
font-size: 1.5rem; /* Adjust this value for mobile */
}
.static-text {
font-size: 1.5rem; /* Adjust this value for mobile */
}
}
2. Adjust the “rem” font size
For example:
For larger text: font-size: 2rem;
For even larger text: font-size: 2.5rem;
For very large text: font-size: 3rem;
You can adjust both the container and static text sizes to ensure consistency. The changing word (in the box) will automatically scale with the container's font size.
🔥 6. Adjust the Animation Speed
The words rotate every 2 seconds. To make it faster or slower, edit this in the JavaScript:
const interval = 2000; // 2 seconds
Example: To make it rotate every 1.5 seconds, change it to:
const interval = 1500;