2012-10-18 37 views

回答

2

入住這演示http://jsfiddle.net/wY8Wb/3/

代碼:

$('#videoimg').click(function(){ 
    $(this).fadeOut('slow'); 
    $('#color') 
     .css({ 
      top: ($(this).offset().top + $(this).height()/2) + 'px', 
      height: 0 
     }) 
     .animate({ 
      // the hard-coded "9" you see below is half of the 
      // difference between the final heights of the 2 divs == (300-282)/2. 
      // Given here so as to have the color div expand out 
      // equally at top and bottom 
      top: ($(this).offset().top - 9) + 'px', 
      height: '300px' 
     }, 'slow'); 
}) 
1

的jsfiddle:http://jsfiddle.net/wY8Wb/17/

$(document).ready(function(){ 
    $('#videoimg').click(function(){ 
    $(this).fadeOut('slow'); 
     $('#color').animate({height: '300px', top: '0px'}, 'slow'); 

}) 
});​ 

更改css也