javascript - Fix a div when scrolling down a page and then un-fix - Stack Overflow

I am trying to make a sidebar div sit below a header secion, when you scroll down, it will turn into a

I am trying to make a sidebar div sit below a header secion, when you scroll down, it will turn into a fixed div and stay fixed until the bottom of the page, once it reaches a footer section, it will stick to the top of it and allow me to scroll down the footer area without seeing it anymore.

There is a perfect emaxple of what I am trying to describe on this site

In the left column, it sticks as you scroll down and then un-sticks at the bottom

I am looking for a good way to do this, hopefully an example or tutorial, I realize it is done with javascript changing the divs properties. I have tried searching but all I could find was old outdated articles over 5-6 years old and they only did half the job. I am not sure even what to call this feature?

I am trying to make a sidebar div sit below a header secion, when you scroll down, it will turn into a fixed div and stay fixed until the bottom of the page, once it reaches a footer section, it will stick to the top of it and allow me to scroll down the footer area without seeing it anymore.

There is a perfect emaxple of what I am trying to describe on this site http://madebymany./blog/apples-aesthetic-dichotomy

In the left column, it sticks as you scroll down and then un-sticks at the bottom

I am looking for a good way to do this, hopefully an example or tutorial, I realize it is done with javascript changing the divs properties. I have tried searching but all I could find was old outdated articles over 5-6 years old and they only did half the job. I am not sure even what to call this feature?

Share Improve this question asked Oct 31, 2011 at 16:54 JasonDavisJasonDavis 49k107 gold badges326 silver badges559 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

That web site is using jQuery Scroll Follow.

Note that according to the jQuery Scoll Follow web site...

The Scroll Follow object will remain inside its immediate container.

... hence why the scrolling stops before the ments on your example web site; the element which is scrolling on the page is constrained inside of its parent <aside> element. You can check out the example.

You basically handle the page's scroll event and move the box around.

Most tutorials require jQuery, so get familiar with it. If you want a tutorial, here's a working one: http://designwoop./2011/01/how-to-create-a-jquery-sticky-sidebar/.

Why not dissect the code of that website too?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744691338a4588226.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信