How to create scroll indicator using html, css and JavaScript

Hello friends, today we will be going to how do we How Create Scroll Indicator Using Html, CSS and JavaScript. I have posted many videos and articles before related to the JavaScript project, now this the something new that we are going to build.

Video Tutorial of How To Create Scroll Indicator Using Html, CSS and JavaScript


As you have seen on the given video tutorial of  How To Create Scroll Indicator Using Html, CSS and JavaScript, 

If you are feeling bored watching the given video tutorial of How To Create Scroll Indicator Using Html, CSS and JavaScript then you can copy or download the given codes below:


How To Create Scroll Indicator Using Html, CSS and JavaScript | Free Source Code

To create this program (Scroll Indicator). First, you need to create two Files one HTML File and another one is CSS File. After creating these files just paste the following codes in your file.

In the first place, make a HTML document with the name of index.html and glue the given codes in your HTML record. Keep in mind, you've to make a document with .html extension.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Scroll Indicator</title>
</head>
<body>
    <div id="indicator"></div>
    <div id="scrollPath"></div>
    <section>
        <h2>Creative Scroll Indicator</h2>
            <p> paste your text here </p>
        </section>
    <script>
        let indicator = document.getElementById('indicator');
        let totalHeight = document.body.scrollHeight - window.innerHeight;
        window.onscroll = function(){
            let indicatorWidth = (window.scrollY / totalHeight) * 100;
            indicator.style.width = indicatorWidth + "%";
        }
    </script>
</body>
</html>
Second, make a CSS record with the name of style.css and glue the given codes in your CSS document. Keep in mind, you've to make a record with .css extension.
*
{
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}
body
{
   padding: 80px 9%; 
   background: #ccc;
}
section
{
    padding: 50px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}
section h2
{
    font-size: 2em;
    color: #999;
}
section p
{
    line-height: 1.5;
    font-size: 1.2em;
    color: #999;
}
#scrollPath
{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.05);
}
#indicator
{
    position: fixed;
    top: 0;
    left: 0;
    height: 10px;
    background: linear-gradient(to top, #008aff,#00ffe7);
    animation: animate 5s linear infinite;
}
@keyframes animate
{
    0%
    {
        filter: hue-rotate(0deg);
    }
    100%
    {
        filter: hue-rotate(360deg);
    }
}
#indicator::before
{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #008aff,#00ffe7);
    filter: blur(30px);
}
#indicator::after
{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #008aff,#00ffe7);
    filter: blur(30px);
}
That’s all, now you’ve successfully created a program to How To Create Scroll Indicator Using Html, CSS & JavaScript. If your code doesn’t work or you’ve faced any error/problem, please download the source code files from the given download button. It’s free and a .zip file will be downloaded then you’ve to extract it.
Click on the following download button to download all source code files.


Download Now
Please Wait...
Direct Link click here.

How can I help you

Post a Comment

How can I help you

Post a Comment (0)

Previous Post Next Post