$(window).on("scroll", function() { if($(window).scrollTop() > 50) { $(".header").addClass("active"); } else { //remove the background property so it comes transparent again (defined in your css) $(".header").removeClass("active"); } });

Upload Files

  • NOTE: Please do not include filenames with special characters such as ' @ ! $ ( ) and others.
  • 8 + 9 =