在這個演示http://tympanus.net/Tutorials/StickyTableHeaders/index3.html中,有沒有一種方法可以讓頂部和側面的欄位保持絕對位置?所以當用戶滾動水平或垂直時,而不是以滾動速度向上或向下或向左或向右浮動時,它會保持鎖定位置,而後面的表正在滾動?De-animate Sticky Header
1
A
回答
2
正如@Miah說,CSS過渡性質應該被刪除。我強迫它沒有。
.sticky-wrap .sticky-thead,
.sticky-wrap .sticky-col,
.sticky-wrap .sticky-intersect {
transition: none !important;
}
而且在jquery.stickyheader.js
,scroll
被稱爲具有15ms的油門。
對於左側立柱
$t.parent('.sticky-wrap').scroll($.throttle(15, function() {
變化......
$t.parent('.sticky-wrap').scroll($.throttle(0, function() {
對於頭球頂
.scroll($.throttle(15, repositionStickyHead));
變化...
.scroll($.throttle(0, repositionStickyHead));
...
完整片段
.sticky-wrap .sticky-thead,
.sticky-wrap .sticky-col,
.sticky-wrap .sticky-intersect {
transition: none !important;
}
<link rel="stylesheet" type="text/css" href="https://tympanus.net/Tutorials/StickyTableHeaders/css/normalize.css" />
<link rel="stylesheet" type="text/css" href="https://tympanus.net/Tutorials/StickyTableHeaders/css/demo.css" />
<link rel="stylesheet" type="text/css" href="https://tympanus.net/Tutorials/StickyTableHeaders/css/component.css" />
<div class="component">
<table class="">
<thead>
<tr>
<th>Population</th>
<th>Alpha</th>
<th>Beta</th>
<th>Gamma</th>
<th>Delta</th>
<th>Epsilon</th>
<th>Zeta</th>
<th>Eta</th>
<th>Theta</th>
<th>Iota</th>
<th>Kappa</th>
<th>Lambda</th>
<th>Mu</th>
<th>Nu</th>
<th>Xi</th>
<th>Omicron</th>
<th>Pi</th>
<th>Rho</th>
<th>Sigma</th>
<th>Tau</th>
<th>Upsilon</th>
</tr>
</thead>
<tbody>
<tr>
<th>Sample #1</th>
<td>23</td>
<td>88</td>
<td>8</td>
<td>2</td>
<td>67</td>
<td>83</td>
<td>81</td>
<td>37</td>
<td>91</td>
<td>96</td>
<td>13</td>
<td>3</td>
<td>95</td>
<td>98</td>
<td>10</td>
<td>87</td>
<td>70</td>
<td>54</td>
<td>72</td>
<td>75</td>
</tr>
<tr>
<th>Sample #2</th>
<td>14</td>
<td>21</td>
<td>20</td>
<td>21</td>
<td>9</td>
<td>68</td>
<td>60</td>
<td>73</td>
<td>22</td>
<td>29</td>
<td>9</td>
<td>49</td>
<td>49</td>
<td>66</td>
<td>58</td>
<td>10</td>
<td>8</td>
<td>24</td>
<td>19</td>
<td>65</td>
</tr>
<tr>
<th>Sample #3</th>
<td>4</td>
<td>50</td>
<td>89</td>
<td>72</td>
<td>99</td>
<td>90</td>
<td>24</td>
<td>86</td>
<td>95</td>
<td>44</td>
<td>32</td>
<td>97</td>
<td>18</td>
<td>90</td>
<td>81</td>
<td>9</td>
<td>38</td>
<td>4</td>
<td>85</td>
<td>15</td>
</tr>
<tr>
<th>Sample #4</th>
<td>10</td>
<td class="err">Parse error</td>
<td>32</td>
<td>45</td>
<td>53</td>
<td>29</td>
<td>35</td>
<td>35</td>
<td>75</td>
<td>9</td>
<td>69</td>
<td>66</td>
<td>93</td>
<td>42</td>
<td>81</td>
<td>85</td>
<td>72</td>
<td>70</td>
<td>15</td>
<td>38</td>
</tr>
<tr>
<th>Sample #5</th>
<td>85</td>
<td>42</td>
<td>71</td>
<td>56</td>
<td>30</td>
<td>3</td>
<td>41</td>
<td>87</td>
<td>94</td>
<td>99</td>
<td>24</td>
<td>20</td>
<td>96</td>
<td>62</td>
<td>90</td>
<td>13</td>
<td>38</td>
<td>47</td>
<td>9</td>
<td>6</td>
</tr>
<tr>
<th>Sample #6</th>
<td>18</td>
<td>80</td>
<td>85</td>
<td>65</td>
<td>9</td>
<td>93</td>
<td>93</td>
<td>61</td>
<td>49</td>
<td>10</td>
<td>45</td>
<td>3</td>
<td>93</td>
<td>61</td>
<td>4</td>
<td>80</td>
<td>2</td>
<td>60</td>
<td>53</td>
<td>81</td>
</tr>
<tr>
<th>Sample #7</th>
<td>30</td>
<td>81</td>
<td>46</td>
<td>50</td>
<td>71</td>
<td>60</td>
<td>8</td>
<td>33</td>
<td>87</td>
<td>34</td>
<td>35</td>
<td>74</td>
<td>34</td>
<td>31</td>
<td>97</td>
<td>10</td>
<td>40</td>
<td>95</td>
<td>92</td>
<td>93</td>
</tr>
<tr>
<th>Sample #8</th>
<td>23</td>
<td>88</td>
<td>8</td>
<td>2</td>
<td>67</td>
<td>83</td>
<td>81</td>
<td>37</td>
<td>91</td>
<td>96</td>
<td>13</td>
<td>3</td>
<td>95</td>
<td>98</td>
<td>10</td>
<td>87</td>
<td>70</td>
<td>54</td>
<td>72</td>
<td>75</td>
</tr>
<tr>
<th>Sample #9</th>
<td>14</td>
<td>21</td>
<td>20</td>
<td>21</td>
<td>9</td>
<td>68</td>
<td>60</td>
<td>73</td>
<td>22</td>
<td>29</td>
<td>9</td>
<td>48</td>
<td>44</td>
<td>66</td>
<td>58</td>
<td>15</td>
<td>8</td>
<td>24</td>
<td>19</td>
<td>65</td>
</tr>
</tbody>
</table>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-throttle-debounce/1.1/jquery.ba-throttle-debounce.min.js"></script>
<script src="https://cdn.rawgit.com/shivammathur/a703480e7ecaab648c501946f0602922/raw/42e4058257ac5c22069392bdc4f6b2b3aaf26033/stickyheader.js"></script>
1
在component.css從CSS的此塊刪除過渡:
.sticky-wrap .sticky-thead,
.sticky-wrap .sticky-col,
.sticky-wrap .sticky-intersect {
opacity: 0;
position: absolute;
top: 0;
left: 0;
transition: all .125s ease-in-out;
z-index: 50;
width: auto; /* Prevent table from stretching to full size */
}
正如在這裏看到:
.sticky-wrap .sticky-thead,
.sticky-wrap .sticky-col,
.sticky-wrap .sticky-intersect {
opacity: 0;
position: absolute;
top: 0;
left: 0;
z-index: 50;
width: auto; /* Prevent table from stretching to full size */
}
0
相關問題
- 1. Sticky Header/Javascript
- 2. Sticky Header,達到一個點
- 3. sticky header - 用jquery添加填充
- 4. Sticky Header跳轉向下滾動
- 5. 如何將sidenav固定到現有的Sticky Header上?
- 6. CSS Sticky Footer
- 7. jquery sticky div gap
- 8. CSS Sticky Footer實現問題
- 9. Wordpress floating/sticky box
- 10. Apache Sticky會話
- 11. Bootstrap Responsive sticky footer
- 12. Javascript sticky dependent dropdown
- 13. CSS Sticky Footer Margin
- 14. Zurb Foundation Sticky Footer
- 15. Bootstrap Sticky Footer
- 16. Bootstrap 3和Sticky Footer
- 17. css jquery sticky navbar前景
- 18. Sticky Top Bar過渡問題
- 19. Sticky Footer W/JQuery Mobile
- 20. Jquery Sticky Nav問題
- 21. jquery tablesorter類sticky-false
- 22. Sticky Div需要吃
- 23. Apache Camel Sticky Http Routing
- 24. Haproxy Sticky-Table not updating
- 25. CSS Sticky Bar - 無法放置在中間
- 26. asp.net mvc display header with header
- 27. Sticky UITableView在Unity中滾動
- 28. Sticky-Kit元素跳躍
- 29. 基礎框架| Sticky Div?
- 30. Bootstrap 4.sticky-top變更爲
這個作品謝謝! – Keith
很酷。只要將答案標記爲已接受即可。 –