Page Widget How to - Slide down background with jQuery








Question

We would like to know how to slide down background with jQuery.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.bloque {<!--   w  w  w  .  j  ava 2 s . c o m-->
  position: relative;
  width: 200px;
  height: 400px;
  background: #eee;
}

.bloque .descripcion, .bloque .informacion {
  position: absolute;
}

.bloque .descripcion {
  
}

.bloque .informacion {
  display: none;
  background: #ccc;
  width: 200px;
  height: 400px
}
</style>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
$(".bloque").hover(
    function() {
        $(this).find('.informacion').stop(false, true).slideDown();
    }, function() {
        $(this).find('.informacion').stop(false, true).slideUp('fast');
    }
);
});//]]>  
</script>
</head>
<body>
  <div class="bloque">
    <div class="descripcion">Titulo</div>
    <div class="informacion">Mas informacion...</div>
  </div>
</body>
</html>

The code above is rendered as follows: