Guest User

Untitled

a guest
Mar 18th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(function() {
  3. var widths = new Array;
  4.  
  5. /* get max column widths from tables */
  6. $('table').each(function() {
  7. i = 0;
  8. $(this).find('thead th').each(function() {
  9. w = $(this).width();
  10.  
  11. if (!widths[i]) {
  12. widths[i] = 0;
  13. }
  14. if (w > widths[i]) {
  15. widths[i] = w;
  16. }
  17. ++i;
  18. });
  19. });
  20.  
  21. /* now that we have got the max column widths, apply them
  22. * to all tables so that the columns line up
  23. */
  24. $('table').each(function() {
  25. i = 0;
  26. $(this).find('thead th').each(function() {
  27. $(this).width(widths[i++]);
  28. });
  29. });
  30. });
  31. </script>
Add Comment
Please, Sign In to add comment