[英]How do I change an inner div to fixed after I scroll to the bottom of it?
[英]How To Change Div To “Fixed” After Scroll
在Academicearth的About頁面上,它們的右側有一個<aside>
標記,一旦您開始滾動,該標記就會fixed
。
http://academicearth.org/about/
怎么做?
在<aside>
標記fixed
,它還向右移一點,以適應滾動顯示的內容。
使用滾動事件。
$(document).scroll(function(e)
{
//grab position of scrollbar
position=$(document).scrollTop();
//when position match a height
if(position==desired_height)
{
//grab element
$('ele').css('position','fixed');
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.