Hi Sanjay,
Can you please attach any prototype in which format you are expecting the output to be it will be helpful to give you a solution.
Hi Sanjay,
I hope this one helpful to you.
window.onscroll = function() {myFunction()};
function myFunction() {
if (document.documentElement.scrollTop > 50) {
document.getElementById("myP").className = "test"; // here you get to navbar element div and apply your class name
} else {
document.getElementById("myP").className = "";
}
}
please referral this link https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onscroll2
hello members finally problem has been solved
i used jquery scroll method to solve this, by the javascript it was not working but when i use jquery code it done.
code ------------
--------------------------------------------------------------------------------------------------------
$(window).scroll(function() {
var topOfWindow = $(window).scrollTop();
if (topOfWindow > 20) {
$('.nav-layout').addClass("active2");
$('.nav-link').addClass("text-dark");
} else {
$('.nav-layout').removeClass("active2");
$('.nav-link').removeClass("text-dark");
}
});
i hope it will help to other community members.