Making a div expand with jQuery without moving divs floating to it

前端 未结 4 1831
悲哀的现实
悲哀的现实 2021-01-16 00:02

I\'m trying to get an effect similar to what you can find at http://www.nokiausa.com/us-en/products/ with a grid of basic information, where a click expands information over

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-16 00:56

    Ok, I managed to find a solution which pretty much follows the approach I mentioned in the question - this clones the cell, which in turn animates. CSS properties ensure "expandinatorright" sits absolutely on top of its parent (of course, with z-index making sure it is rendered above everything else).

        function growRight(){
            $('.stuff')
                .clone(false)
                .addClass('expandinatorright')
                .appendTo($('.stuff'));
            $('.expandinatorright').animate({
                backgroundColor: "#FF8600"
            }, 750 );
            $('.expandinatorright').animate({
                width: "510px"
            }, 750, function() {});
        }
    

    I hope this is useful for anyone who might run into a similar problem.

提交回复
热议问题