Link to home
Start Free TrialLog in
Avatar of rivkamak
rivkamakFlag for United States of America

asked on

Jquery float div

I have a div three quarters down the page.
Is there a way to float a div once you reach that point, then it'll follow you down. once you come back up, it'll stop at it's point where it belongs.
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

by float I suspect you are not referring to floating in a CSS sense but rather having the div fixed as you scroll down but if you scroll back up once it gets to its inline position it "sticks"

This would need javascript where you position the div absolutely relative to its container and then as the viewport scrolls add the scroll amount to the top css attribute.

When scrolling back you subtract from the top element until top = 0.
Avatar of rivkamak


Any easy code on this?
Do you want the div to always stay in the same place or move up when the page scrolls and when it gets to the top then stay in the same place?
Avatar of Steve Krile
Steve Krile
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is this working for you?