cross color text reveal on scroll

How we can change text color on scroll using HTML CSS JS? Solution: See this Color Cross Text Reveal On Scroll Using CSS and JavaScript.

Previously I have share many text related programs, but this is about crossing colors on the scroll. Basically, the color cross effect is the switch between dark and light color according to the background. The main aim of this effect is showing characters clearly and creating cool and special effects on the element.

Today you will learn to create a text color switch program on scroll up or down. Basically, there is an image box and a text above or over the image. The part of the text which is over the image it color is white and the other is black, the text is change positon on scrolling. Text movement on scroll creates a little bit parallax effect.

So, Today I am sharing Color Cross Text Reveal On Scroll Using CSS and JavaScript. There I have used CSS for styling and JavaScript for changing the text’s position on scroll up or down. There is no jQuery or any other library, you can call this a pure CSS JS program. Many modern websites uses this kind of effect on their website, you also can use it.

If you are thinking now how this color cross effect actually is, then see the preview given below.

Preview Of Change Color When Scrolling

See this video preview to getting an idea of how this program looks like.

Live Demo

Now you can see this visually, also you can see it live by pressing the button given above. If you like this, then get the source code of its.

You May Also Like:

Color Cross Text Reveal On Scroll Source Code

Before sharing source code, let’s talk about it. First I have created a main div named container and put 3 sections for image and text inside it. There I have created 2 sections of text because of one with dark color and one with white color. Also in the HTML file, I have linked other files like CSS, JS, and font.

Now using CSS I have placed all the elements in the right place, as you can see in the preview. I gave basic values using CSS like size, margin, padding, position, etc. I gave white color to one text and the other is black by default. In the HTML file when I have created the texts I gave a class name to identify the texts separately. There I have used CSS @media query to creating responsive elements.

JavaScript handling here the movement feature on scrolling. JS fetched the text using document.querySelectorAll command. Left all other things you will understand after getting the codes, I can’t explain all in writing. For creating this program you have to create 3 files, First for HTML, second fro CSS, and the third file for JavaScript. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

function.js

The last step, create a JavaScript file named ‘function.js‘ and put the codes.

That’s It. Now you have successfully created Color Cross Text Reveal On Scroll Using CSS and JavaScript. If you have any doubt or questions comment down below.

Thanks For Visiting, Keep Visiting.

1 COMMENT

  1. What if i want one header to scroll from left to right and another header to scroll from right to left? How to change?

LEAVE A REPLY

Please enter your comment!
Please enter your name here