change scrollbar color code example

Example 1: change scrollbar color

.scrollable-element {
  scrollbar-color: red yellow; /* red is for the thumb and yellow is for the track */
}

Example 2: javascript on scroll change nav color

$(function () {
  $(document).scroll(function () {
    var $nav = $(".navbar-fixed-top");
    $nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
  });
});

Example 3: scrollbar with 2 different colors on same page css

::-webkit-scrollbar-track {
    background-color: #333;
}

/* Override styles for <div>s, for example */
div::-webkit-scrollbar-track {
    background-color: #b13131;
}

Tags:

Css Example