[英]How to make a scroll to fixed div that doesn't stick to the top
I have a side bar like on this demo, that starts at a certain position on the page and as you scroll down it bounces a long with that position. 我在此演示中有一个侧边栏,该边栏从页面上的某个位置开始,当您向下滚动时,在该位置弹跳较长。 I'd like something like that but without the bouncing.
我想要类似的东西,但不要弹跳。
http://blog.echoenduring.com/wp-content/uploads/demos/echo_ContainedStickyScroll/ http://blog.echoenduring.com/wp-content/uploads/demos/echo_ContainedStickyScroll/
The closest I have come are the other scroll to fixed position questions but I don't want my div to have to hit the top of the page to become fixed. 我最接近的是其他滚动到固定位置问题的滚动条,但是我不希望我的div不得不点击页面顶部来固定。 How do I do this?
我该怎么做呢?
Check the scroll of the page : 检查页面滚动:
if($(window).scrollTop() < somePosition) {
$("mydiv").css("position","fixed");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.