how to start animate on scroll in jquery code example
Example 1: jquery scroll when object appear on screen make animation
$(window).on("scroll", function(){
if($(window).scrollTop() + $(window).height() - 100 >= $(".target").offset().top){
alert("On viewport");
}
})
Example 2: jquery scroll when object appear on screen make animation
body{
padding-top: 150vh;
}
.target{
background: red;
width: 100%;
height: 50px;
margin-bottom: 500px;
}