$(document).ready(function(){
$(window).scroll(function(){
var scroll = $(this).scrollTop();
if (scroll > $('.fix').offset().top-($(window).height()/2)){
$(".fix").css({
console.log(scroll);
'transition' : 'all 1s ease',
'opacity' : '1'});
}
});
});
.fix{
transition: opacity 1s ease;
opacity: 0;
}
.fix.active{
opacity: 1;
}
$(document).ready(function(){
var $window = $(window), $fix = $(".fix");
$window.scroll(function(){
var curScroll = $window.scrollTop();
var keyPoint = $fix.offset().top - $window.height() / 2;
$fix.toggleClass("active", curScroll >= keyPoint);
});
});