当桌子很大时,为什么滚动速度会变慢?如何在没有插件的情况下改进它?

时间:2017-03-06 05:50:23

标签: jquery html html-table

我把220,000个细胞放在桌子上,它工作正常。

我设置了高度和宽度,我把滚动和表滚动很慢。

如果没有插件,它怎么能比现在更快?

HTML,JS和CSS代码

function a() {
  var text = "";
  for (var i = 0; i < 10000; i++) {
    text += "<tr>";
    for (var j = 0; j < 22; j++) {
      text += "<td class='a'>" + j + "</td>"
    }
    text += "</tr>";
  }
  $("#table_body").html(text);
}
a();
table {
  display: block;
  width: 700px;
  height: 4400px;
  overflow-x: auto;
  overflow-y: auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<table>
  <thead>
    <tr>
      <th>adsad1</th>
      <th>adsad2</th>
      <th>adsad3</th>
      <th>adsad4</th>
      <th>adsad5</th>
    </tr>
  </thead>
  <tbody id="table_body">
  </tbody>
</table>

0 个答案:

没有答案