本帖最后由 qiuqiu_henry 于 2013-08-25 12:19:47 编辑

解决方案 »

  1.   

    思路:绝对定位,y坐标<0 时就把它改为0. 可以用js实现。 
      

  2.   

    com.style(id, {position : "fixed"});
    不管滚动条到哪里,div的位置始终不变
      

  3.   

     var ie6 = /msie 6/i.test(navigator.userAgent);
      var tableDv = $('.table-css1');
          var st;
          tableDv.attr('otop', tableDv.offset().top); //存储原来的距离顶部的距离
          $(window).scroll(function () {
              st = Math.max(document.body.scrollTop || document.documentElement.scrollTop);
              if (st>= parseInt(tableDv.attr('otop'))) {
                  if (ie6) {//IE6不支持fixed属性,所以只能靠设置position为absolute和top实现此效果
                   tableDv.css({ position: 'absolute', top: st });
                  }
                  else if (tableDv.css('position') != 'fixed') tableDv.css({ 'position': 'fixed', top: 0 });
              } else if (tableDv.css('position') != 'static') tableDv.css({ 'position': 'static' });
          });
    哥们  上面的代码 你只需要把固定的id传进去即可  其他不用改