Quantcast
Channel: esconder seccion div
Viewing all articles
Browse latest Browse all 6

esconder seccion div

$
0
0

Buen dia a todos

tengo un inconveniente con un formulario que estoy construyendo en un proyecto .net

A manera de ejemplo tengo una pagina HTML responsive, la cual después de determinado ancho habilita un navicon (en el código lo represento como un botón) y una función javascriptque al oprimir el botón despliegue un div(que contendría mi menú, el despliegue consiste en variar su altura height de 0 a 100).

lo hace muy bien el botón pero cuando vuelvo la pagina al tamaño máximo de la pantalla la idea es que el menú desaparezca y eso lo manejo con la  variable @media screen  en un css.  Despues de determinado ancho la idea es que desaparezca el div (colocando su valor alto en 0 nuevamente) al maximizar el ancho del screen.  Lastimosamente al dar click y llamar la funcion java script no esta tomando el cambio al aumentar el ancho de pantalla en la validacion con la variable @media screen

me pueden dar una ayuda  por favor  copio aca el código HTML y el css

/código pagina html**********************/


<head Runat=Server>
    <meta charset="utf-8">
    <link href="css/nada.css" rel="stylesheet" type="text/css" />
  
</head>
<div id="boton" onclick="divLogin()">
Mostrar/Ocultar
</div>
<div id="caja">
</div>

<script type="text/javascript"> 
var clic = 1;
function divLogin(){
   if(clic==1){
   document.getElementById("caja").style.height = "100px";
   clic = clic + 1;
   } else{
       document.getElementById("caja").style.height = "0px";     
    clic = 1;
   }  
}
</script>

/código archivo css**********************/

#boton{
 padding: 10px;
 background: orange;
 width: 95px;
 cursor: pointer;
 margin-
 margin-bottom: 10px;
 box-shadow: 0px 0px 1px #000;
 display: inline-block;
}
#boton:hover{
 opacity: .8;
}
#caja{
 width: 100%;
 margin: auto;
 height: 0px;
 background: #000;
 box-shadow: 10px 10px 3px #D8D8D8;
 transition: height .4s;
}

/*******************************************************Large screens ----------- */
@media screen and (min-width : 1824px) {

#caja{
 height: 0px;
}
}

/*******************************************************Desktops and laptops ----------- */
@media only screen and (min-width : 1224px) {
#caja{
 height: 0px;
}
   
}
/********************************************************/
@media screen and (min-width:1024px) and (max-width:1224px) {
#caja{
 height: 0px;
}
}
/*******************************************************iPads (portrait) ----------- */
@media screen and (min-width:768px) and (max-width:1024px) and (orientation : portrait) {
#caja{
 height: 0px;
}

}

/* iPads (portrait) ----------- */
@media screen and (min-width:768px) and (max-width:1024px) and (orientation : landscape) {
#caja{
 height: 0px;
}

}
@media screen and (min-width:480px) and (max-width:768px) {
    /*pilas a partir de este tamaña va el menu vertical*/
#caja{
 height: 0px;

}
}
@media screen and (min-width:320px) and (max-width:480px) {
   
#caja{
 height: 0px;

}
}
@media screen and (max-width:320px) {

#caja{
 height: 0px;

}

}


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>