tabel thead 滑动固定顶部

  • 试了几种方法,还是 translateY 比较靠谱
  • 放弃 ie
// 固定头部
var thead_top = $('thead').offset().top;
$(window).scroll(function() {
  var sctop = $(this).scrollTop();
  if(sctop > 60){
    var ty = sctop - thead_top;
    thead.css({'transform':'translateY('+ ty +'px)'});
  } else{
    thead.css({'transform':'translateY(0px)'});
  }
})

猜你喜欢

转载自blog.csdn.net/pintu274111451/article/details/80270922