This article will share with you how to use HTML + CSS + JS to achieve perfect compatibility with the TABLE fixed columns of various browsers. it is very practical, especially for enterprise-level applications in BS architecture, if you have any need, refer. In enterprise applications of BS architecture, when a table has a large number of columns, a common requirement is to fix the previous important columns, in this way, when you drag the scroll bar, a fixed column will help you view the data, and the user experience is good. Some heavyweight JS component libraries also have this function. Is there a simpler way to implement this function?
The common solution to this requirement is table joining. if you want to create a static webpage or a dynamic page with simple functions, the logic is simple and technically not complex, it is easy to implement, but if you want to make components with many dynamic functions, you need to write a lot of redundant code, which is difficult to maintain. even a simple function requires a lot of code, for example, event processing, etc. this method is clumsy and has poor flexibility. it is not a good solution.
After a long period of analysis and research, we have found a solution with excellent compatibility in various scenarios. In general, we use the positioning calculation method. the following code is provided, and then make an explanation.
Untitled Document