/    Sign up×
Community /Pin to ProfileBookmark

Div position fixed only after scrolling past it

I want to have a div with a fixed position that floats at the top only when you scroll past it.

An example:
[url]http://www.quirksmode.org/blogs.shtml[/url]
If you scroll down the website, the “show site navigation” div stays stuck at the top, but if you scroll back to the top, it goes back to it’s position.

I want to imitate this effect, but I’m having a little bit of trouble viewing the javascript code.. any help?

Thanks,
Kurt

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@_KurtauthorNov 25.2008 — found out how!! thanks anyway!
Copy linkTweet thisAlerts:
@mattalexxMay 23.2009 — found out how!! thanks anyway![/QUOTE]

Just registered with the forum just to post on this thread.

I don't know how much you use online forums, but it is really bad etiquette to say "found out how!! Nevermind all" without explaining what you found out.

Share the wealth! There are people who will find this post in the future who would really like to know how you did it, including me.

?
×

Success!

Help @_Kurt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...