Accidentally passing by the Firefox community finds that their floating layer following the scroll bar is smoother than they did before,
Naturally, I'm curious to use Firebug to analyze its structure:
1. At first, I felt like I was writing the same principle. I used the following to control the floating layer display position.
View sourceprint? Top: 0;
Position: absolute;
2. Compared with my own, I found that the Top: 0 in the Firefox community has never changed.
The scroll bar changes the value.
3. Paste its CSS and Html code. If Javascript control is absent, CSS will play a magical role.
The useless CSS statements are deleted layer by layer until the header style is deleted. The floating layer does not scroll with the scroll bar,
The following three lines of code determine that the floating layer follows
View sourceprint? Padding: 10px 0 0;
Position: fixed;
Width: 300px;