MITライセンスのfooterFixed.js
http://blog.webcreativepark.net/2007/11/16-012253.html
すご~く便利なのだけど、メインエリアの背景が切れてしまうので、改造してみた。
要jQuery
JavaScriptだけで改造できるとかっこいいんだろうな……。
HTML(だいたい。)footerがfooterWrapに直してないのはちょっと恥ずかしいかなと思いつつ、そのまま公開。
気になるようなら個人的に直すといいんだろうな。
<div id="#headerWrap"> </div> <div id="#mainWrap"> </div> <div id="footer"> </div>
footerFixed.jsの改造部分。
30行目付近から。
if(ft+fh<wh){
//追記部分開始
var mainH = wh - fh - $('#headerWrap').height();
//追記終了
//記述変更
// document.getElementById(footerId).style.position = "relative";
// document.getElementById(footerId).style.top = (wh-fh-ft-1)+"px";
document.getElementById(footerId).style.top = (wh-fh-ft)+"px";
//追記部分開始
$('#mainWrap').css({height:mainH});
//追記終了
}