user3932810 user3932810 - 4 months ago 8
Javascript Question

Link div sections to navigation buttons

I have a web page which has 5 panels in different colors. And there is navigation bullet on right side of the page.

When scrolling the page I want each section to linked with the navigation bullets. Bullet should have

active
class based on which slide is shown on the viewport.

Any help would be appreciated.

DEMO

Answer

I have taken your code in my local and applied below JS and after that its working fine.

Just add Scrollit.Js in your project.

Just you have to do minor changes in your CSS file like below.

In your CSS file line no. #55

.parallax_nav a:active,
.parallax_nav a:focus,
.parallax_nav a.js--active {
    background: #f5f5f1;
    opacity: 1;
}

just replaxe it with

.parallax_nav a:active,
.parallax_nav a:focus,
.parallax_nav a.active {
    background: #f5f5f1;
    opacity: 1;
}

It will be working fine like as you want. Per section it will be apply active class on your <a> tag.