How to make a div
remain fixed after you scroll to that div
? I have a div
that is later in a page and you need to scroll to get to that div
.
If I use:
.divname {
position: fixed;
}
The div
will appear before it should appear normally. Maybe a good example of what I need is second ad on 9gag. If your screen resolution is low enough, you won't see that ad after you load the front page, but after you scroll down, you'll see the second ad and it will remain fixed while you scroll down.
it worked for me
Try this ! just add class .to_move_content to you div
This is possible with CSS3. Just use
position: sticky
, as seen here.I know this is tagged html/css only, but you can't do that with css only. Easiest way will be using some jQuery.
http://jsfiddle.net/5n5MA/2/
jquery function is most important
Then use JQuery Lib...
Now use HTML
Check DEMO HERE