Jump to content

keep div in place while scrolling


ohdang888

Recommended Posts

The easiest way to do it is through CSS, using the position property:

 

.fixed
{
  position:fixed;
  top:30px;
  right:5px;
}

 

This will make anything with the class="fixed" stick to 30px from the top of the browser window, and 5px from the right of the browser window. The div will hover above any other page elements and will not disrupt the natural flow of the website. You could also do this through javascript, to get a smooth, floating appearance. This, however, requires a bit more work.

 

-jm

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.