css
.StylishBox{
height:100px;
width:200px;
background:pink;
position:absolute;
top:800px;
opacity:0;
}
javascript
$("document").ready(function(){
$(window).scroll(function(){
var scrollTop = $(this).scrollTop();
var boxTop = $('.StylishBox').offset().top;
var controlOpacity = 1400;
if(scrollTop + 100 > boxTop)
{
$(".StylishBox").css("top","64px");
$(".StylishBox").css("position","fixed");
$(".StylishBox").css("opacity", ((scrollTop - 800)/(controlOpacity - 800)));
}
if(scrollTop < 800){
$(".StylishBox").css("top","800px");
$(".StylishBox").css("position","absolute");
$(".StylishBox").css("opacity", ((scrollTop - 800)/(controlOpacity - 800)));
}
});
});
Adjust the value of controlOpacity variable as needed. It determines how quickly the div fades out as you scroll. Lower values lead to faster fading, while higher values result in a slower fadeout.
Check out this JSFiddle example