tags:

views:

65

answers:

1

how can i get stackoverflow's overlay that appears at the very top ?

when i scroll up and down, it is very smooth.

how do i do this with jquery ?

+6  A: 

It's a fixed positioned element.

#foo { position: fixed; top: 0; left: 0; width: 100%; z-index: 2; }

<div id="foo">
  <p>This is my fixed element!</p>
</div>

Then you can use cookies to see if the user has visited before and show it with jQuery.

NOTE: The z-index on #foo must be higher than any elements that appear to be sitting on top of it.

Colin
Make sure you add a VALID DOCTYPE or IE7/8 will not support position: fixed.
Alec Smart
problem is, sometimes the elements on the page covers the overlay....how to fix this ? also i dont get what u meant by valid doctype..... thank you.
give #foo a z-index will update.
Colin