Add a class to body tag after certain amount of scroll

<script>
$(document).ready(function(){
    $(window).scroll(function() {    
	addScrollClass();
    });
    addScrollClass();

    function addScrollClass() {
	var headerSec = $("body");   
	var scrollFtop = $(window).scrollTop();
	if ( scrollFtop >= 50 ) { // change 50 with your number
		headerSec.addClass("scroll");
	} else {
		headerSec.removeClass("scroll");
	}
    }
});
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *