HTML
<div class="fadein">
フェードしたいhtmlの要素
</div>
javascript
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.3.min.js"></script>
<script>
$(function(){
$(window).scroll(function (){
$('.fadein').each(function(){
var elemPos = $(this).offset().top;
var scroll = $(window).scrollTop();
var windowHeight = $(window).height();
if (scroll > elemPos - windowHeight + 200){
$(this).addClass('scrollin');
}
});
});
});
</script>
CSS
.fadein {
opacity : 0;
transform : translate(0, 50px);
transition : all 300ms;
}
.fadein.scrollin {
opacity : 1;
transform : translate(0, 0);
}