Attenuation and scaling at the same time. This can be reorganized a bit, but this is the idea:
$(".btn a").click(function () { var boxleft = $('.box').outerWidth()/2; var boxtop = $('.box').outerHeight()/2; var imgleft = $('.box img').outerWidth()/2; var imgtop = $('.box img').outerHeight()/2; $('.box').animate({ 'opacity' : 0, 'width': 0, 'height': 0, 'left': boxleft + 'px', 'top': boxtop + 'px' }); $('.box img').animate({ 'opacity' : 0, 'width': 0, 'height': 0, 'left': imgleft + 'px', 'top': imgtop + 'px' }); });
CSS (added position: relative ):
.box { display: block; width:200px; height:200px; background-color: red; position: relative; }
DEMO: http://jsfiddle.net/uTDay/12/
Tallboy
source share