jq 实现头像(气泡式浮动)

前提:假设每个头像都装在li中。

    function headMove() {
            $('li').each(function () {
                var myLeft = Math.floor(Math.random()*(myWidth+1))-128;
                var myTop = Math.floor(Math.random()*(myHeight+1))-128;
                if (myLeft < 0) {
                    myLeft = 0;
                }
                if (myTop < 0) {
                    myTop = 0;
                }
                $(this).animate({left:myLeft,top:myTop},15000,'linear')
            })
        }
原文地址:https://www.cnblogs.com/candy-Yao/p/9274094.html