tags:

views:

44

answers:

3

I would like to create an element on a website that scrolls as you scroll down the window. In most cases, I know this could easily be solved with some basic css using fixed positioning. The issue is, I would not like it to be in the same space on the screen at all times. I would like it to be a sidebar element that starts with the rest of the content, but then moves with you as you scroll down the page. See http://www.demonoid.com/ for an example (see the ad on the right side of the page). I know there is probably a fairly easy css or jquery solution, but I have not been able to think of one. I appreciate the help.

Thanks!

A: 

Maybe just a

   if($(window).scrollTop>300) {

        $("#image").position().top($(window).scrollTop()-$(window).height());

   }
jamie-wilson
+1  A: 

Here's a really great tutorial to create fixed-floating elements using jQuery:

Fixed Floating Elements | jQuery for Designers

Justin Niessner
Thanks! This had exactly what I was looking for!
Andrew
+1  A: 

View source at demonoid.com! :)

Bradley Herman