Juan Camacho Juan Camacho - 9 months ago 31
jQuery Question

How can I create a static <div>?

I would like create a static

, if user uses the scroll, the
must be still.

Context: I am working in a project and I need three static components, I managed to make two components but as I am using JSF, Primefaces and Bootsfaces (bootstrap and JQuery), the third component must be different. The thrid component must be a typical

My code:
1. html:

<div id = "divProyecto">

2. css:

background-color: blue;
height: 50px;
margin-top: 10px;
width: 100%;
display: block;
border: solid #222222 1px;

3. js (I found this code, but doesn't work):

$(document).ready(function () {

This image resume all: http://s2.subirimagenes.com/imagen/9622798algo.gif
The image show as the black boxes don't move, but blue box move with scroll.

Thanks you!


You should use position: fixed;

And specify the

top: 100px;
left: 100px;