页脚固定页面底部

来源:互联网 发布:日本和服的来源知乎 编辑:程序博客网 时间:2024/04/30 18:36

页脚固定页面底部 页面滚动也是底部 OK


<title>固定在页面底部的滚动公告</title>
    <style type="text/css">
    html,body,div ul{margin:0;padding:0;border:0; font-size:12px}
    #gg{position:fixed;bottom:0;background:#000;width:100%;height:23px;z-index:9999;opacity:.60;filter:alpha(opacity=40);_bottom:auto;_width:100%;_position:absolute;_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
 #gg a {color:#FFF}
    </style>
<script type="text/javascript">
(function($){
 $.fn.extend({
  Scroll:function(opt,callback){
  if(!opt) var opt={};
  var _this=this.eq(0).find("ul:first");
  var lineH=_this.find("li:first").height(),
  line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10),
  speed=opt.speed?parseInt(opt.speed,10):3000,//卷动速度,数值越大,速度越慢(毫秒)
  timer=opt.timer?parseInt(opt.timer,10):3000;//滚动的时间间隔(毫秒)
   if(line==0) line=1;
   var upHeight=0-line*lineH;
   scrollUp=function(){
    _this.animate({
    marginTop:upHeight
   },speed,function(){
    for(i=1;i<=line;i++){
     _this.find("li:first").appendTo(_this);
    }
    _this.css({marginTop:0});
   });
  }
  _this.hover(function(){
   clearInterval(timerID);
  },function(){
   timerID=setInterval("scrollUp()",timer);
  }).mouseout();
 }
 })
})(jQuery);
$(document).ready(function(){
 $(".bulletin").Scroll({line:1,speed:500,timer:3000});//修改此数字调整滚动时间
});
</script>
    </head>
    <body>
<div style="text-align:center;">
    <ul><li>1</li></ul>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
    <ul><li>3</li></ul>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>123123123<br>
123123123<br>123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
    <ul><li>4</li></ul>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>123123123<br>
123123123<br>123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
    <ul><li>5</li></ul>
123123123<br>
123123123<br>
123123123<br>
123123123<br>
123123123<br>123123123<br>
123123123<br>


</div>
<div id="gg"><a href="/">固定在页面底部的滚动公告</a></div>
    </body>
    </html>

原创粉丝点击