Tell me how to make a table, what would the header always be seen when scrolling?

I use bootstrap , jQuery / angularjs

  • Is a <table> a regular <table> or a million <div> 's (as libraries like to create beauty like to do)? - Regent

1 answer 1

Add position: fixed; to the desired element during scrolling. For this solution, you need jQuery.

 var win = $(window); var element = $('#someId'); //идентификатор элемента, который нужно сделать фиксированным var height = 200; //лимит высоты, поиграйтесь со значением, пока не добъетесь подходящего вам win.scroll(function(){ if(win.scrollTop() >= height) { element.addClass('fixed'); } else { element.removeClass('fixed'); } }); 

and add to css

 .fixed { position: fixed; } 
  • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky
  • And what can there be not clear? Or does a detailed answer imply writing everything for him? It would be better to have stupid questions filtered. The man learned the angular, but does not know about the fixed elements. - GONG
  • Stack Overflow is just needed in order to share knowledge (in particular, so that the author of the question finally learns about the above elements). Please try to write more detailed answers. - Nicolas Chabanovsky
  • okay, let it be yours, only here on the original stackoverfow for such a question would the karma be merged - GONG
  • Thank! I can not agree with you that this issue is poorly structured. I just ask, in part, to follow the recommendations : either give a detailed answer, or pass by. Moreover, if in your opinion the issue is not a place on the site, you can vote against it or use the alarm signal. Questions with a negative rating from time to time are automatically removed from the site. - Nicolas Chabanovsky