I'm trying to make a vertical social share buttons for a blog post.
I want the "share_DIV" position to be fixed after scrolling to a certain point.
- because the "Share_DIV" is not supposed to appear on header area, its
position will be absolute and calculated by jQuery to let it be under
*the header*
and*the title*
, then when you scroll down and reach the text body "share_DIV" should start walking with you while scrolling down to the end of the text body.
So the share_DIV should move vertically on the scroll event, only between START POINT -> END POINT
share_DIV has class .vertical-container
in fiddle code.
Fiddle Example will explain exactly what I need.
How can I get it done with jQuery?
Perhaps this is what you want: Fiddle
Basically, you need to catch the
scroll event
by usingThen check whether the current
scroll position
is greater than theposition
of.content
, and not greater than the.content
position added by it'sheight
Here's the full code on how to do it:
Here it is:
http://jsfiddle.net/h5t7pgfb/76/
CSS:
Jquery: