Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Click on Menu Navigation animate to that Section

I have a menu, when I clicked on each nav, it used to animate to resume on that specific section.

enter image description here

Somehow, now it didn't do that anymore recently.

What should I check? I see nothing in my console.

Live : https://www.bunlongheng.com/


I used JS

This is the snippet

$('#main-menu').onePageNav({
    currentClass: "active",
    changeHash: false,
    scrollThreshold: 0.5,
    scrollSpeed: 750,
    filter: "",
    easing: "swing"
});
like image 651
code-8 Avatar asked Nov 16 '20 02:11

code-8


2 Answers

You only need to add this one line of code.

$('html').css("scroll-behavior", "smooth");
like image 118
myjobistobehappy Avatar answered Sep 22 '22 09:09

myjobistobehappy


if you were using css then you're missing this line scroll-behavior: smooth;

and if u were using js then please provide a snippet :) thanks for your collaboration.

like image 22
Boudy hesham Avatar answered Sep 23 '22 09:09

Boudy hesham