Creat scroll bar

Posted in: Newspaper
Post count: 90

How to create a page scroll progress bar like this https://www.screencast.com/t/57b9bJ3oZD

Post count: 35449

Hi,

Unfortunately our theme do not have that option, most probably that is set with a custom code or a plugin.

Thank you for your understanding!

Post count: 90

I have h some code please tell us where to past these code-

Html code – <div class="header">
<h2>Scroll Indicator</h2>
<div class="progress-container">
<div class="progress-bar" id="myBar"></div>
</div>
</div>

<div>content...</div>

2nd CSS code –
/* Style the header: fixed position (always stay at the top) */
.header {
position: fixed;
top: 0;
z-index: 1;
width: 100%;
background-color: #f1f1f1;
}

/* The progress container (grey background) */
.progress-container {
width: 100%;
height: 8px;
background: #ccc;
}

/* The progress bar (scroll indicator) */
.progress-bar {
height: 8px;
background: #4caf50;
width: 0%;
}

Js code –
// When the user scrolls the page, execute myFunction
window.onscroll = function() {myFunction()};

function myFunction() {
var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
var scrolled = (winScroll / height) * 100;
document.getElementById("myBar").style.width = scrolled + "%";
}

Post count: 18283

Hello !

In theme panel you can insert custom CSS / JS as you can see here: https://www.screencast.com/t/bWTJ1izWYZ2

Thank you !

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.