Add class on scroll jquery

Today, We want to share with you add class on scroll jquery.In this post we will show you add/remove class when scrolling over section / sticky sidebar, hear for Add/remove class with jquery based on vertical scroll? we will give you demo and example for implement.In this post, we will learn about Simple Jquery Scroll To Top with an example.

Add/remove class with jquery based on vertical scroll?

Example 1: index.html

    <title>This is Pakainfo -</title>
            body {
                height: 2500px;
            .sidebar div {
 width: 150px;
 height: 250px;
 float: right;
 position: fixed;
 z-index: 1;

 .sidebar ul {
 list-style-type: none; 
 padding-left: 0;
 position: fixed;

  .normal {
  font-size: 13px;
  background: gray;
  color: white;
  text-transform: uppercase; 
  width: 80px;

  .active {
  width: 140px;
  font-size: 25px;
  text-transform: uppercase;
  color: white;
       <div class="sidebar">
        <li id="pop" class="normal">Home</li>
        <li class="normal">Programs</li>
        <li class="normal">Replay</li>
        <script src=""></script>

            $(window).on("scroll",function() {

                if($(this).scrollTop() > 500) 






Add/remove class on scroll down and scroll up

Example 2:

<div class="box">1</div>
//After scroll down add class box-hover
<div class="box box-hover">1</div>

$(document).ready(function() {
      if ($(this).scrollTop() > 50) {
      } else {

Example 3:
Add or remove class with JQuery based on vertical scroll

$(window).scroll(function() {
   if ($(this).scrollTop() > 150){
   } else {

header { height: 50px }
header .menu a { height: 1.2em }
.small { height: 25px }
.small .menu a { height: 1em }

I hope you get an idea about add/remove class when scrolling over section.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.