Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/04/2015, 13:35
Avatar de NueveReinas
NueveReinas
 
Fecha de Ingreso: septiembre-2013
Ubicación: No tan Buenos Aires
Mensajes: 1.101
Antigüedad: 10 años, 8 meses
Puntos: 145
Respuesta: ocultar div al detener desplazamiento

Lo he hecho usando jQuery, por si a alguien le sirve: http://jsfiddle.net/2en4u069/

Código HTML:
Ver original
  1. <div id="test"></div>

Código CSS:
Ver original
  1. html{
  2.     width: 100%;
  3.     height: 100%;
  4. }
  5.  
  6. body{
  7.     width: 100%;
  8.     height: 200%;
  9. }
  10.  
  11. div{
  12.     width: 50%;
  13.     height: 35%;
  14.     background: red;
  15.     margin: 0 auto;
  16. }

Código Javascript:
Ver original
  1. var cuadro = $("#test");
  2.  
  3. var alturaTotal = cuadro.outerHeight();
  4.  
  5. $(window).scroll(function(){
  6.    if ($(this).scrollTop() > alturaTotal){
  7.     cuadro.css("display","none");
  8.    };
  9. });
__________________
¿Te sirvió la respuesta? Deja un +1