$(document).ready(function(){
    setFooterPosition(".footer");
    $(window).resize(function() {
      setFooterPosition(".footer");
    });
});
function setFooterPosition($footer){
    windowH = jQuery(window).height();
    bodyH = $('body').height();
    footerH = $($footer).height();
    if(windowH > bodyH){
        $($footer).css('top',windowH - footerH);
    }else {
        $($footer).css('top',bodyH);
    }
    $($footer).css('display','block');
}
