jQuery Scale and Fade at the same time

后端 未结 6 1581
星月不相逢
星月不相逢 2021-02-03 13:32

So I can make a div to scale nicely from it\'s center pivot: http://jsfiddle.net/uTDay/

However, the transition starts to change when I add in content inside the div: ht

6条回答
  •  别那么骄傲
    2021-02-03 14:18

    I have taken my time on this one:

    ALL boxes hide, and scale to their relative heights based on each elements properties.

    http://jsfiddle.net/uTDay/11/

    Code, using a function variable to be DRY.

    var hide_those_boxes = function () {
        $('.box , .box img').each(function(ix, obj) {
                $(obj).animate({
                    opacity : 0, 
                    left: '+='+$(obj).width()/4, 
                    top: '+='+$(obj).height()/4,
                    height:0, 
                    width:0
                }, 
                3000, 
                function() { $(obj).hide(); }
            );
        });
    }
    
    
    $(".btn a").click(hide_those_boxes);
    

提交回复
热议问题