How is the navigation bar fixed on the home page of Taobao store?

it looks like this without sliding at first, as shown in figure
clipboard.png

,:

clipboard.png

ask the gods, how do you do this?

Mar.23,2021

take a look at the code and use position:sticky


position:sticky


to judge the height above the navigation bar. When it reaches a certain value, set position


1. Directly use position:sticky
2. Listen for scrolling and set position to fixed or absolute

when scrolling to a location
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ec7d29-2e84.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ec7d29-2e84.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?