2015.05.01
これやで〜
CSS
footer {
background: #000;
color: #fff;
padding: 20px 0;
position: fixed;
width: 100%;
left: 0;
bottom: -200px;
}
Script
(function($){
$(function(){
$(window).on('scroll',function(){
var obj = new Object();
obj.y = document.documentElement.scrollTop || document.body.scrollTop;
if(obj.y > 500){ //500pxスクロールしたらbottom:0pxの位置にアニメーション
$('footer').animate({
bottom: '0px'
},'slow',function(){
$(this).stop(true,true).queue([]);
});
} else {
$('footer').animate({ //500px以内なら下方向へ200pxアニメーション(つまり画面外に動かす)
bottom: '-200px'
},'slow',function(){
$(this).stop(true,true).queue([]);
});
}
});
});
})(jQuery);