简体   繁体   English

可滚动表排序 - 如何抑制水平滚动位置转换的伪像,以保持滚动位置?

[英]Scrollable table sorting - How to suppress artifacts of horizontal scroll position translation, in order to preserve scroll position?

I want to sort a table that can be scrolled horizontally as the table is wider than the browser width. 我想排序一个可以水平滚动的表,因为表比浏览器宽度宽。 I am using PHP/JS but not using AJAX. 我使用PHP / JS但不使用AJAX。

The problem is when I scroll to the right to sort on the rightmost column, I need to preserve the horizontal scroll position when sorting. 问题是当我向右滚动以对最右边的列进行排序时,我需要在排序时保留水平滚动位置。

What I did was to fake the position by first using JS to scroll to the position. 我做的是首先使用JS滚动到位置来伪造位置。 But that happens after page load. 但这是在页面加载后发生的。 So I "see" translation. 所以我“看到”翻译。

So, to fake it, I used css to immediately translate (transform) the element to the right. 所以,为了伪造它,我使用css立即将元素转换(转换)到右边。 Then when page loads I immediately translate to the left in JS (using the css transform, to restore position) then I use JS to scroll to the desired position. 然后当页面加载时我立即在JS中向左翻译(使用css变换,恢复位置)然后我使用JS滚动到所需的位置。

Firefox and Edge do not have an issue doing this and don't show any intermediate translation flicker or artifacts. Firefox和Edge在执行此操作时没有问题,也不会显示任何中间翻译闪烁或工件。

Only my IE 11 shows the artifact of translation on page load. 只有我的IE 11显示页面加载时的翻译工件。

How do I suppress this flicker effect in IE so the user only sees the table being sorted at its desired position? 如何在IE中抑制此闪烁效果,以便用户只能看到表格在其所需位置进行排序?

I have provided some code in an earlier post 我在之前的帖子中提供了一些代码

How do I prevent page flicker in IE which does not appear in Firefox? 如何防止IE中没有出现在Firefox中的页面闪烁?

I am not sure if you are looking for jquery or css solution so I will post what I have seen as a workable css solution..but the jquery being the most used. 我不确定你是否正在寻找jquery或css解决方案所以我将发布我所看到的可行的css解决方案..但jquery是最常用的。 I always prefer css when possible where styling is considered. 在考虑样式的情况下,我总是更喜欢css。

<!--[if IE]>
<meta http-equiv="Page-Enter" content="blendTrans(duration=0)" />
<meta http-equiv="Page-Exit" content="blendTrans(duration=0)" />
<![endif]-->

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM