[jQuery] Re: keep div element visible in viewport

2008-01-27 Thread robing

Thanks Klaus,

I just forgot about the css support of ie 7, i guess im going back to
my 1990's memories of the spyware adverts on the screen.

thank you very much.

Robin

On Jan 28, 10:14 am, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> On Jan 27, 9:19 pm, robing <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > Is it possible to keep an element visible in the viewport even when
> > the page has been scrolled, so as you scroll the page the header (for
> > example) either gets bumped down or becomes visible when the scrolling
> > stops?
> > I know this can be done in frames but I would rather use jquery.
>
> > any help would be appreciated.
>
> > Robin
>
> Simple CSS does the job here:
>
> #header {
>     position: fixed;
>     top: 0;
>
> }
>
> This will also look much smoother than constantly repositioning via
> JS. Note that IE 6 needs some extra trickery to make that work - it
> doesn't support fixd 
> positioning:http://www.howtocreate.co.uk/fixedPosition.html
>
> --Klaus


[jQuery] Re: keep div element visible in viewport

2008-01-27 Thread Klaus Hartl

On Jan 27, 9:19 pm, robing <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> Is it possible to keep an element visible in the viewport even when
> the page has been scrolled, so as you scroll the page the header (for
> example) either gets bumped down or becomes visible when the scrolling
> stops?
> I know this can be done in frames but I would rather use jquery.
>
> any help would be appreciated.
>
> Robin

Simple CSS does the job here:

#header {
position: fixed;
top: 0;
}

This will also look much smoother than constantly repositioning via
JS. Note that IE 6 needs some extra trickery to make that work - it
doesn't support fixd positioning:
http://www.howtocreate.co.uk/fixedPosition.html


--Klaus