[英]How do I tell when the top or bottom of an element scrolls to the top of the page using vanilla javascript
[英]how do i get a navigation that scrolls with page and stick when it reaches the top nav with plain javascript
如何在用戶滾動時使div elememt向上移動,然后在到達頁面頂部時保持固定狀態? 我已經有一個固定的酒吧,我期望這個div留下來。
你想要的是一個粘性塊。 有一個(相對)新的CSS功能position: sticky
,但不幸的是它並不適用於所有瀏覽器。 您可以將它與polyfill結合使用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.