2011-07-24 90 views

回答

1
var img = $('.anImage'), 
    offset = img.offset(); 

// position image absolutely in the same position to allow it to expand 
img.css({ 
     position: "absolute", 
     top: offset.top, 
     left: offset.left, 
     zIndex: 100 
    }) 
    // animate expansion 
    .animate({ 
     top: 0, 
     left: 0, 
     width: img.parent().width(), 
     height: img.parent().height() 
    }, "fast") 
    // fadeout 
    .fadeOut("fast"); 

唯一的要求是,你離開父元素與position: relative

+0

這個工程很好,我只需要將fadeout改爲.fadeTo('slow',0.3)!非常感謝你!!! –