Arreglando la navegación div para que no se oculte al desplazarse

I have this sample HTML5 page which have a navigation and a content area pasted on JSFiddle.

El problema es que <div id="nav"> isn't fixed when I scroll vertically. How can I make the navigation to be fixed on the top of the browser even with scrolled vertically?

preguntado el 28 de mayo de 14 a las 12:05

is así Qué estás buscando ? -

3 Respuestas

DEMO

body {
    margin: 0px;
    width: 100%;
    height: 120%;
    background: red;
}
#nav {
    position: fixed;
    width: 100%;
    z-index: 99;
    height: 25px;
    background: blue;
}

contestado el 28 de mayo de 14 a las 12:05

Utilice la herramienta position:fixed e z-index property (the issue you had was due to the layers : your fixed div estaba bajo #area div) :

#nav{
   position:fixed;
   top:0;
   width:100%;
   height: 25px;
   z-index:50;
   background: blue;
}

Ejemplo

contestado el 28 de mayo de 14 a las 12:05

It worked well. Unfortunately, area should always be under nav not behind it. Would it be possible if z-index no está configurado? - David B

@Dr. Java: Te gusta? Aplica top:25px En el correo electrónico “Su Cuenta de Usuario en su Nuevo Sistema XNUMXCX”. #area división - potasio

Create another hidden navigation (same with already used nav), and show it when user scrolls down enough.

Esta es un buen tutorial Para hacer eso.

Y aqui esta some edited and working example desde mi sitio web.

contestado el 28 de mayo de 14 a las 12:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.