[Solved] change div color after scrolling 15% down with jquery [closed]


Try:

$(document).ready(function () {
   var $scrollingDiv = $("#navbar");

   $(window).scroll(function () {
       $scrollingDiv.stop()
           .animate({
           "marginTop": ($(window).scrollTop() + 0) + "px"
       }, "slow");
       $scrollingDiv.css("background-color", (($(window).scrollTop() / $(document).height()) > 0.15) ? "orange" : "");
     });
});

Demo

1

solved change div color after scrolling 15% down with jquery [closed]