Bootstrap: affix plugin doesn't work well in tables

Created on 22 Aug 2012  路  3Comments  路  Source: twbs/bootstrap

Please look at the demo I created in codepen:

http://codepen.io/leomao10/pen/tEuqC

I tried to affix the table header and the new table header created by affix.js will not use its original width.

That bugs me for a day and still don't have a clue.

All 3 comments

it because after position:fixed for thead, rowspan doesn't work for TH.
set fixed width should help (works in chrome):

  $(".floating-header th").each(function() {
      $(this).width($(this).width());
  });

Yay, the header looks good now :)

It haven't work perfectly because the columns in tbody will changed its width when affix.js hide the origin header.

But I have some idea how to fix that.

@genbit, Thanks for your help

When you position something, you need to specify a width. We won't support fixing table headers at this time.

Was this page helpful?
0 / 5 - 0 ratings